Skip to main content

Auth0

Follow these steps to add Auth0 as a social sign-in provider to your project using the Ory Console:

  1. Sign in to Ory Console and select Social Sign-in.

  2. Click the switch next to the Auth0 logo to start the configuration.

  3. Copy the Redirect URI and save it for later use.

  4. Create an Auth0 Application for your Auth0 Tenant, noting the following points:

    • Choose the application type to be Regular Web Applications.
    • Paste the saved Redirect URI from Ory into the Allowed Callback URLs field in the Settings tab of the registered application.
  5. Go to the Settings tab of the registered application on the Auth0 dashboard and copy the following data to the corresponding fields in the form in the Ory Console:

    • Client ID
    • Client Secret
  6. In the Scopes field of the form in the Ory Console, add the following scopes:

    • openid
    • profile
    • email
  7. In the Data Mapping field of the form in the Ory Console, add the following Jsonnet code snippet, which maps the desired claims to the Ory Identity schema:

    local claims = {
    email_verified: false,
    } + std.extVar('claims');

    {
    identity: {
    traits: {
    // Allowing unverified email addresses enables account
    // enumeration attacks, if the value is used for
    // verification or as a password login identifier.
    //
    // Therefore we only return the email if it (a) exists and (b) is marked verified
    // by Auth0.
    [if 'email' in claims && claims.email_verified then 'email' else null]: claims.email,
    username: claims.nickname,
    },
    },
    }
    info

    Auth0 returns only the sub and sub_legacy claims in the id_token. Ory makes a request to Auth0's /userinfo API and adds the user info to std.extVar('claims').

    danger

    Don't save secrets such as API keys, credentials, or personal data directly in Jsonnet code snippets. Jsonnet code snippets used for data mapping aren't stored in an encrypted format in The Ory Network.

  8. Click Save Configuration.