Get Login Status

This function will return the user data without showing a menu. If the user is not logged in, it will return null. If the user is logged in but not connected to the application, it will return not_linked. Otherwise, it will return an authResponse the same as login() or register() will.

var fnCallback = function(response){
    console.log(response);
}

ID.getLoginStatus(fnCallback, force)

Register

Opens a menu showing fields needed to register a new user. If the user is already logged in, it will close the menu and return to the redirect URI or callback.

Usage

var fnCallback = function(response) {
    console.log(response);
}

ID.register(fnCallback)

Callback

The callback argument is optional. If omitted or null the user will be redirected to redirect_uri. The callback function will be passed an authResponse Object containing the user’s authentication data.

Depending on the init response_type See options below the authResponse Object vary.

Using response_type = code

{
  authResponse: {
    code: "60667aa4f14bf2a66ccbacdf1c092834766473efab67ce3fb219018d24c401f7"
    redirect_uri: "http://mysite.com/callback?code=60667aa4f14bf2a66ccbacdf1c092834766473efab67ce3fb219018d24c401f7"
    state: null
  }
  status: "ok"
}

Using response_type = token

{
  authResponse: {
    access_token: "249bf6efac2372a4e9e35d5e1d9f250675bfde70760b6566893ba194937353c9"
    details: {
      avatars: {
      large_secure_url: null,
      medium_secure_url: null,
      thumb_secure_url: null,
      },
      email: "user@example.com"
      first_name: "Yoda"
    },
    expires_in: 21600
    redirect_uri: "http://example.com/callback#access_token=249bf6efac2372a4e9e35d5e1d9f250675bfde70760b6566893ba194937353c9&expires_in=21600&token_type=bearer"
    scope: ""
    state: null
    token_type: "bearer"
  },
  status: 'ok'
}

Options

You can pass an Object options as second parameter

List of options:

Name Description
redirect_uri An url to redirect the user after registration
response_type Can be either code or token
state A random string to allows you to prevent Cross-site scripting
meta
An Object where you can set custom parameters to display to the user
Name Description
alternate An alternate name to display instead of your default application name.
alternate_tos_url An alternate terms of service url to display instead of your default terms of service url
alternate_privacy_url An alternate privacy policy url to display instead of your default terms of service url

Login

It is the same process as Register

You may use the same callback and options for Register and Login

Usage

var fnCallback = function(response){
    console.log(response);
}

ID.login(fnCallback)