OAuthAuthenticator

auth. OAuthAuthenticator

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

Constructor

new OAuthAuthenticator(options)

Source:
Parameters:
Name Type Description
options Object

Authenticator options.

Name Type Attributes Description
baseUrl String

The auth0 account URL.

clientId String <optional>

Default client ID.

clientSecret String <optional>

Default client Secret.

Members

(inner) clientOptions :Object

Options object for the Rest Client instace.

Source:
Type:
  • Object

Methods

passwordGrant(userData) → {Promise|undefined}

Sign in using a username and password

Source:
Parameters:
Name Type Description
userData Object

User credentials object.

Name Type Attributes Description
username String

Username.

password String

User password.

realm String <optional>

Name of the realm to use to authenticate or the connection name

Returns:
Type:
Promise | undefined
Example

Given the user's credentials perform the OAuth password grant or Password Realm grant if a realm is provided, it will return a JSON with the access_token and id_token. More information in the API Docs .

var data = {
  client_id: '{CLIENT_ID}',  // Optional field.
  username: '{USERNAME}',
  password: '{PASSWORD}'
  realm: '{CONNECTION_NAME}', // Optional field.
  scope: 'openid'  // Optional field.
};

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

  console.log(userData);
});

signIn(userData) → {Promise|undefined}

Sign in using a username and password.

Source:
Parameters:
Name Type Description
userData Object

User credentials object.

Name Type Description
username String

Username.

password String

User password.

connection String

The identity provider in use.

Returns:
Type:
Promise | undefined
Example

Given the user's credentials and the connection specified, it will return a JSON with the access_token and id_token. More information in the API Docs .

var data = {
  client_id: '{CLIENT_ID}',  // Optional field.
  username: '{USERNAME}',
  password: '{PASSWORD}
  connection: '{CONNECTION_NAME}',
  scope: 'openid'  // Optional field.
};

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

  console.log(userData);
});

socialSignIn(data) → {Promise|undefined}

Sign in using a social provider access token.

Source:
Parameters:
Name Type Description
data Object

User credentials object.

Name Type Description
access_token String

User access token.

connection String

Identity provider.

Returns:
Type:
Promise | undefined