Skip to content

Instantly share code, notes, and snippets.

@nov
Created August 19, 2016 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nov/c9eb082eb77cae23bc59f3529fea965b to your computer and use it in GitHub Desktop.
Save nov/c9eb082eb77cae23bc59f3529fea965b to your computer and use it in GitHub Desktop.
$client_id = "<YOUR-CLIENT-ID>"
$client_secret = "<YOUR-CLIENT-SECRET>"
$redirect_uri = "<YOUR-CALLBACK-URL>"
$authz_endpoint = "https://graph.facebook.com/oauth/authorize"
$token_endpoint = "https://graph.facebook.com/oauth/token"
open ($authz_endpoint + "?client_id=" + $client_id + "&redirect_uri=" + $redirect_uri)
$code = Read-Host "code"
$params = @{
client_id = $client_id;
client_secret = $client_secret;
code = $code;
grant_type = "authorization_code";
redirect_uri = $redirect_uri;
}
$result = Invoke-RestMethod -Uri $token_endpoint -Method Post -Body $params
$result.access_token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment