src/authentication/index.js
function Authentication(auth0, options) {
  // If we have two arguments, the first one is a WebAuth instance, so we assign that
  // if not, it's an options object and then we should use that as options instead
  // this is here because we don't want to break people coming from v8
  if (arguments.length === 2) {
    this.auth0 = auth0;
  } else {
    options = auth0;
  }

  /* eslint-disable */
  assert.check(
    options,
    { type: 'object', message: 'options parameter is not valid' },
    {
      domain: { type: 'string', message: 'domain option is required' },
      clientID: { type: 'string', message: 'clientID option is required' },
      responseType: { optional: true, type: 'string', message: 'responseType is not valid' },
      responseMode: { optional: true, type: 'string', message: 'responseMode is not valid' },
      redirectUri: { optional: true, type: 'string', message: 'redirectUri is not valid' },
      scope: { optional: true, type: 'string', message: 'scope is not valid' },
      audience: { optional: true, type: 'string', message: 'audience is not valid' },
      _disableDeprecationWarnings: {
        optional: true,
        type: 'boolean',
        message: '_disableDeprecationWarnings option is not valid'
      },
      _sendTelemetry: {
        optional: true,
        type: 'boolean',
        message: '_sendTelemetry option is not valid'
      },
      _telemetryInfo: {
        optional: true,
        type: 'object',
        message: '_telemetryInfo option is not valid'
      }
    }
  );
  /* eslint-enable */

  this.baseOptions = options;
  this.baseOptions._sendTelemetry =
    this.baseOptions._sendTelemetry === false ? this.baseOptions._sendTelemetry : true;

  this.baseOptions.rootUrl = 'https://' + this.baseOptions.domain;

  this.request = new RequestBuilder(this.baseOptions);

  this.passwordless = new PasswordlessAuthentication(this.request, this.baseOptions);
  this.dbConnection = new DBConnection(this.request, this.baseOptions);

  this.warn = new Warn({
    disableWarnings: !!options._disableDeprecationWarnings
  });
  this.ssodataStorage = new SSODataStorage(this.baseOptions);
}
function Authentication(auth0, options) {
  // If we have two arguments, the first one is a WebAuth instance, so we assign that
  // if not, it's an options object and then we should use that as options instead
  // this is here because we don't want to break people coming from v8
  if (arguments.length === 2) {
    this.auth0 = auth0;
  } else {
    options = auth0;
  }

  /* eslint-disable */
  assert.check(
    options,
    { type: 'object', message: 'options parameter is not valid' },
    {
      domain: { type: 'string', message: 'domain option is required' },
      clientID: { type: 'string', message: 'clientID option is required' },
      responseType: { optional: true, type: 'string', message: 'responseType is not valid' },
      responseMode: { optional: true, type: 'string', message: 'responseMode is not valid' },
      redirectUri: { optional: true, type: 'string', message: 'redirectUri is not valid' },
      scope: { optional: true, type: 'string', message: 'scope is not valid' },
      audience: { optional: true, type: 'string', message: 'audience is not valid' },
      _disableDeprecationWarnings: {
        optional: true,
        type: 'boolean',
        message: '_disableDeprecationWarnings option is not valid'
      },
      _sendTelemetry: {
        optional: true,
        type: 'boolean',
        message: '_sendTelemetry option is not valid'
      },
      _telemetryInfo: {
        optional: true,
        type: 'object',
        message: '_telemetryInfo option is not valid'
      }
    }
  );
  /* eslint-enable */

  this.baseOptions = options;
  this.baseOptions._sendTelemetry =
    this.baseOptions._sendTelemetry === false ? this.baseOptions._sendTelemetry : true;

  this.baseOptions.rootUrl = 'https://' + this.baseOptions.domain;

  this.request = new RequestBuilder(this.baseOptions);

  this.passwordless = new PasswordlessAuthentication(this.request, this.baseOptions);
  this.dbConnection = new DBConnection(this.request, this.baseOptions);

  this.warn = new Warn({
    disableWarnings: !!options._disableDeprecationWarnings
  });
  this.ssodataStorage = new SSODataStorage(this.baseOptions);
}
function Authentication ( auth0 , options ) { // If we have two arguments, the first one is a WebAuth instance, so we assign that // if not, it's an options object and then we should use that as options instead // this is here because we don't want to break people coming from v8 if ( arguments . length === 2 ) { this . auth0 = auth0 ; } else { options = auth0 ; } /* eslint-disable */ assert . check ( options , { type : 'object' , message : 'options parameter is not valid' } , { domain : { type : 'string' , message : 'domain option is required' } , clientID : { type : 'string' , message : 'clientID option is required' } , responseType : { optional : true , type : 'string' , message : 'responseType is not valid' } , responseMode : { optional : true , type : 'string' , message : 'responseMode is not valid' } , redirectUri : { optional : true , type : 'string' , message : 'redirectUri is not valid' } , scope : { optional : true , type : 'string' , message : 'scope is not valid' } , audience : { optional : true , type : 'string' , message : 'audience is not valid' } , _disableDeprecationWarnings : { optional : true , type : 'boolean' , message : '_disableDeprecationWarnings option is not valid' } , _sendTelemetry : { optional : true , type : 'boolean' , message : '_sendTelemetry option is not valid' } , _telemetryInfo : { optional : true , type : 'object' , message : '_telemetryInfo option is not valid' } } ) ; /* eslint-enable */ this . baseOptions = options ; this . baseOptions . _sendTelemetry = this . baseOptions . _sendTelemetry === false ? this . baseOptions . _sendTelemetry : true ; this . baseOptions . rootUrl = 'https://' + this . baseOptions . domain ; this . request = new RequestBuilder ( this . baseOptions ) ; this . passwordless = new PasswordlessAuthentication ( this . request , this . baseOptions ) ; this . dbConnection = new DBConnection ( this . request , this . baseOptions ) ; this . warn = new Warn ( { disableWarnings : ! ! options . _disableDeprecationWarnings } ) ; this . ssodataStorage = new SSODataStorage ( this . baseOptions ) ; }
Creates a new Auth0 Authentication API client
@constructor
@param {Object} options
@param {String} options.domain your Auth0 domain
@param {String} options.clientID the Client ID found on your Application settings page
@param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response
@param {String} [options.responseType] type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html}
@param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}
@param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`
@param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth
@see {@link https://auth0.com/docs/api/authentication}
Creates a new Auth0 Authentication API client