Skip to content

Instantly share code, notes, and snippets.

@IsaacCisneros
Created May 20, 2015 22:05
Show Gist options
  • Save IsaacCisneros/5ae6dde98ea09378df8d to your computer and use it in GitHub Desktop.
Save IsaacCisneros/5ae6dde98ea09378df8d to your computer and use it in GitHub Desktop.
Basic Auth [PS | GitHub APIv3]
$user = 'user'
$pass = 'pass'
$pair = "$($user):$($pass)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic $encodedCreds"
$Headers = @{
Authorization = $basicAuthValue
}
Invoke-WebRequest -Uri https://api.github.com/users/defunkt -Headers $Headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment