Produces a basic authentication header string from a credential.
ConvertTo-BasicAuthentication.ps1 [-Credential] <PSCredential> [-ProgressAction <ActionPreference>]
[<CommonParameters>]
Invoke-RestMethod https://example.com/api/items -Method Get -Headers @{Authorization=ConvertTo-BasicAuthentication.ps1 (Get-Credential -Message 'Log in')}
Calls a REST method that requires Basic authentication on the first request (with no challenge-response support).
Specifies a user account to authenticate an HTTP request that only accepts Basic authentication.
Type: PSCredential
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
https://tools.ietf.org/html/rfc1945#section-11.1
http://stackoverflow.com/q/24672760/54323
https://powershell.org/forums/topic/pscredential-parameter-help/