Skip to content

Latest commit

 

History

History
53 lines (47 loc) · 1.7 KB

File metadata and controls

53 lines (47 loc) · 1.7 KB

Uses cases

-- Multiple Clients - Multiples App - One API

If you wanna to use multiple Auth0 App and/or Clients -for example if you're creating an open API, you can add as much as you want in the AUTH0.CLIENTS settings parameter

AUTH0 = {
  'CLIENTS': {
      'default': {
          'AUTH0_CLIENT_ID': '<YOUR_AUTH0_CLIENT_ID>',
          'AUTH0_AUDIENCE': '<YOUR_AUTH0_CLIENT_AUDIENCE>',
          'AUTH0_ALGORITHM': 'RS256',  # default used in Auth0 apps
          'PUBLIC_KEY': default_certificate_publickey',
      },
      'web': {
          'AUTH0_CLIENT_ID': '<YOUR_AUTH0_CLIENT_ID>',
          'AUTH0_AUDIENCE': '<YOUR_AUTH0_CLIENT_AUDIENCE>',
          'AUTH0_ALGORITHM': 'RS256',  # default used in Auth0 apps
          'PUBLIC_KEY': web_certificate_publickey',
      },
      'mobile': {
          'AUTH0_CLIENT_ID': '<YOUR_AUTH0_CLIENT_ID>',
          'AUTH0_AUDIENCE': '<YOUR_AUTH0_CLIENT_AUDIENCE>',
          'AUTH0_ALGORITHM': 'RS256',  # default used in Auth0 apps
          'PUBLIC_KEY': mobile_certificate_publickey',
      }
  },
  ...
}

In order to select one of them when the authentication is needed -a POST request, for example- you need to add a header called Client-Code -by default, but you can customize it-. The names of the clients are case sensitive.

-- Custom User Model with | in user id

Auth0 user ids are usually shaped as provider|id (for example auth0|123). By default this package rewrites | to . to be compatible with Django's default User model username constraints.

If your custom user model supports | in its username field, disable the rewrite:

AUTH0 = {
  ...,
  'REPLACE_PIPE_FOR_DOTS_IN_USERNAME': False,
}