OAuthAuthenticator

auth. OAuthAuthenticator

Abstracts the sign-in, sign-up and change-password processes for Database & Active Directory auhtentication services.

Constructor

new OAuthAuthenticator(options)

Parameters:
Name Type Description
options Object Authenticator options.
Properties
Name Type Attributes Description
baseUrl String The auth0 account URL.
clientId String <optional>
Default client ID.
Source:

Methods

signIn(userData) → {Promise|undefined}

Sign in using a username and password.
Parameters:
Name Type Description
userData Object User credentials object.
Properties
Name Type Description
username String Username.
password String User password.
connection String The identity provider in use.
Source:
Returns:
Type
Promise | undefined
Example

Given the social provider's access_token and the connection specified, it will do the authentication on the provider and return a JSON with the access_token and id_token. Currently, this endpoint only works for Facebook, Google, Twitter and Weibo. More information in the API Docs .

var data = {
  client_id: '{CLIENT_ID}',  // Optional field.
  access_token: '{USER_SOCIAL_ACCESS_TOKEN}',
  connection: 'facebook',
  scope: 'openid'  // Optional field.
};

auth0.oauth.socialSignIn(data, function (err, userData) {
  if (err) {
    // Handle error.
  }

  console.log(userData);
});

socialSignIn(data) → {Promise|undefined}

Sign in using a social provider access token.
Parameters:
Name Type Description
data Object User credentials object.
Properties
Name Type Description
access_token String User access token.
connection String Identity provider.
Source:
Returns:
Type
Promise | undefined