Created
September 12, 2016 12:36
-
-
Save darrenjrobinson/917397a422126bcc80f4a21177a7082d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#get Access Token | |
$body = "grant_type=authorization_code&redirect_uri=$redirectUri&client_id=$clientId&client_secret=$clientSecretEncoded&code=$authCode&resource=$resource" | |
$Authorization = Invoke-RestMethod https://login.microsoftonline.com/common/oauth2/token ` | |
-Method Post -ContentType "application/x-www-form-urlencoded" ` | |
-Body $body ` | |
-ErrorAction STOP | |
Write-output $Authorization.access_token | |
$accesstoken = $Authorization.access_token | |
$me = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken"} ` | |
-Uri https://graph.microsoft.com/v1.0/me ` | |
-Method Get |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment