Configure Auth0 for your Zype property Configure Auth0 for your Zype property

Configure Auth0 for your Zype property

This is a premium feature requiring custom configuration on your Auth0 account. You must have an active Auth0 account in order to configure this. 

How it works

In this scenario, Auth0 is being used as the database source of truth for all authentication (consumer login) requests.

The Auth0 integration uses an OAuth API proxy, meaning any OAuth POST login requests generated against Zype's OAuth APIs will then be proxied to Auth0's APIs for authentication checks. Zype OAuth API requests must use email/password (grant_type=password) in order to pass full credentials over to Auth0.

If Auth0 authentication passes, Auth0 will return a JWT in response to the login API request. Zype will decode the JWT, and then use it to generate an access token in Zype's database and send back to the original API requester.

Configuration Instructions

Auth0 configuration:

  1. Set up your Auth0 account
  2. Confirm you have an API within your Auth0 account
    1. This can be the Auth0 management API
  3. Click your name profile icon at the top right and click settings to navigate to Tenant Settings
    1. Change the "Default Audience" to your Auth0 API
    2. Change the "Default Directory" to Username-Password-Authentication
    3. Click Save
  4. Go to Applications and create a Machine to Machine app for Zype
    1. Take note of its Client ID and Client Secret as you'll need these for the Zype configuration
  5. Go to Rules and add a new rule that allows the email to be sent in the JWT when signing in:
    1. Create an Empty Rule
    2. Empty everything in the Script box in Auth0
    3. The copy code block below
      1. Replace the API URL in the code block
      2. Replace the namespace with your website domain in the code block
    4. function (user, context, callback) {
      // only add the claims for this specific API
      // you could add more checks/conditions if it makes sense
      if (context.request.body && context.request.body.audience === 'https://your-api-url.auth0.com/api/v2/') { // your Auth0 API Identifier
      const namespace = 'https://yourdomain.com/claims/';
      context.accessToken[namespace + 'email'] = user.email;
      context.accessToken[namespace + 'roles'] = context.authorization.roles;
      }
      callback(null, user, context);
      }
  6. Go to "APIs" and select the API created for Zype
  7. Go to "Machine to Machine Applications"
  8. Authorize the app
  9. Click the drop-down the app's row so you can grant permissions to the app
    1. Zype needs the following permissions at minimum:
      1. read:users
      2. update:users
      3. create:users
      4. Click update when done

Zype configuration:

  1. In your Site Settings, you will see the SSO tab
  2. Select Auth0 from the dropdown menu and enter in your information
    1. Authentication URL: https://your-app-domain/oauth/token
    2. Client ID: Copy from Auth0 app
    3. Client Secret: Copy from Auth0app
    4. Audience URL: API url
    5. Claims Namespace URL: Match the namespace URL from rule defined
    6. Grant type: password
    7. Scopes: 
    8. Connection Name: Username-Password-Authentication

Was this article helpful?

0 out of 0 found this helpful

Articles in this section