Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Authenticate with token to Download File from Raw Githubusercontent
$headers = @{'Accept' = 'application/json'}
$tokenString = "REPLACE-GITHUB-TOKEN-HERE" + ":x-oauth-basic"
$base64Auth = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(($tokenString)))
$headers.Add('Authorization',"Basic $base64Auth")
$content = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/ORG/Repo/master/something.ps1" -Headers $headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment