var clientId = "";
var clientSecret = "";
var scope = null;
var state = "secret123337";
var callback = "deeplink";
service = plugins.oauth.getOAuthService(plugins.oauth.OAuthProviders.FACEBOOK, clientId, clientSecret, null, state, callback)
application.showURL(service.getAuthorizationURL());
function deeplink(a,args) {
service.setAccessToken(args.code);
var response = service.executeGetRequest("https://graph.facebook.com/v2.11/me");
if (response.getCode() == 200) {
application.output(response.getBody());
var json = response.getAsJSON();
application.output("Name is "+json.name);
}
else {
application.output('ERROR http status '+response.getCode());
}
} |