Supported Clients
NGClient

Methods Summary
OAuthService
getOAuthService(provider, clientId, clientSecret, scope, state, callbackmethod)
Creates an OAuth service that can be used to obtain an access token and access protected data.

Methods Details

getOAuthService(provider, clientId, clientSecret, scope, state, callbackmethod)

Creates an OAuth service that can be used to obtain an access token and access protected data.

Parameters

Number
provider
an OAuth provider id, see plugins.oauth.OAuthProviders
String
clientId
your app id
String
clientSecret
your client secret
String
scope
configures the OAuth scope. This is only necessary in some APIs (like Microsoft's).
String
state
configures the anti forgery session state. This is available in some APIs (like Facebook's).
String
callbackmethod
the name of a global method

Returns

OAuthService

Supported Clients

NGClient

Sample

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());
    }
 }