Skip to content

Instantly share code, notes, and snippets.

@vexx32
Created January 11, 2019 01:25
Show Gist options
  • Save vexx32/1e5b1fa68510beda6002883bf401fdde to your computer and use it in GitHub Desktop.
Save vexx32/1e5b1fa68510beda6002883bf401fdde to your computer and use it in GitHub Desktop.
function Invoke-TWAuthentication {
[CmdletBinding()]
param()
$bytes = [System.Text.Encoding]::ASCII.GetBytes('MyAPIKey')
$base64 = [System.Convert]::ToBase64String($bytes)
$basicAuthValue = "Basic $base64"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor
[Net.SecurityProtocolType]::Tls11 -bor
[Net.SecurityProtocolType]::Tls
# Output final object
@{ Authorization = $basicAuthValue }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment