React Native Auth0 - v5.5.0
    Preparing search index...

    Class Auth0

    The main Auth0 client class.

    This class acts as a facade, creating and delegating to a platform-specific client instance (Native or Web) under the hood.

    import Auth0 from 'react-native-auth0';

    const auth0 = new Auth0({
    domain: 'YOUR_AUTH0_DOMAIN',
    clientId: 'YOUR_AUTH0_CLIENT_ID'
    });
    Index

    Accessors

    Constructors

    Methods

    • Provides access to the Management API (e.g., for user patching).

      Parameters

      • token: string

        An access token with the required permissions for the management operations.

      • OptionaltokenType: TokenType

        Optional token type ('Bearer' or 'DPoP'). Defaults to the client's configured token type.

      Returns IUsersClient

    • Generates DPoP headers for making authenticated requests to custom APIs. This method creates the necessary HTTP headers (Authorization and DPoP) to securely bind the access token to a specific API request.

      Parameters

      • params: DPoPHeadersParams

        Parameters including the URL, HTTP method, access token, and token type.

      Returns Promise<Record<string, string>>

      A promise that resolves to an object containing the required headers.

      const credentials = await auth0.credentialsManager.getCredentials();

      if (credentials.tokenType === 'DPoP') {
      const headers = await auth0.getDPoPHeaders({
      url: 'https://api.example.com/data',
      method: 'GET',
      accessToken: credentials.accessToken,
      tokenType: credentials.tokenType
      });

      const response = await fetch('https://api.example.com/data', { headers });
      }
    • Performs a Custom Token Exchange using RFC 8693. Exchanges an external identity provider token for Auth0 tokens.

      Parameters

      Returns Promise<Credentials>

      A promise resolving with Auth0 credentials.

      const credentials = await auth0.customTokenExchange({
      subjectToken: 'external-idp-token',
      subjectTokenType: 'urn:acme:external-idp-token',
      audience: 'https://api.example.com',
      scope: 'openid profile email',
      organization: 'org_abc123'
      });