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. Go to AuthenticationSocial Sign-In in the Ory Console.

  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. Go to the Advanced Settings then Endpoints and copy the Auth0 top-level domain (typically https://myAuth0Tenant.auth0.com) to the Tenant URL field of the form in the Ory Console.

  7. In the Scopes field of the form in the Ory Console, add the following scopes:

    • openid
    • profile
    • email
  8. 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: {
    [if 'email' in claims && claims.email_verified then 'email' else null]: claims.email,
    // 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.

    // Auth0 can also provide a username. If you want to store it in the identity adjust your identity schema as well and make sure to adjust the scopes.
    // 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 Ory Network.

  9. Click Save Configuration.

Troubleshooting

When you add a social sign-in provider, you can encounter common problems such as:

  • Redirect URI mismatch
  • Redirect loops during registration
  • Domain verification issues

To troubleshoot those issues, read Social sign-in troubleshooting.

Requested url does not match any rules

If you see this error after clicking on "Sign in with Auth0", make sure that the "Tenant URL"/issuer_url is set correctly.