Skip to content

Instantly share code, notes, and snippets.

Created December 15, 2022 20:44
What would you like to do?
$consumerToken = "Enter your consumer token here"
$employeeToken = "enter your employee token here"
#Expiration date of the authorization toke you generate is set to 1 day from now.
$expirationDate = get-date ((get-date).Adddays(+1)) -format "yyyy-MM-dd"
$uri = "$consumerToken&employeeToken=$employeeToken&expirationDate=$expirationDate"
#Get token and create header.
$token = ((Invoke-RestMethod -Method PUT -Uri $uri -ContentType "application/JSON").value).token
$user = '0'
$pass = $token
$pair = "$($user):$($pass)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$Header = @{"Authorization" = "Basic $encodedCreds"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment