Auth0

Source Codearrow-up-right

Auth0arrow-up-right is a great authentication-as-a-service platform for free!

A live demoarrow-up-right is available as well as the sourcearrow-up-right.

Usage

auth: {
  strategies: {
    auth0: {
      domain: 'domain.auth0.com',
      client_id: '....',
      audience: 'https://my-api-domain.com/'
    }
  }
}

Anywhere in your application logic:

this.$auth.loginWith('auth0')

User will be redirected to a page like this:

💁 This provider is based on oauth2 scheme and supports all scheme options.

Obtaining client_id, domain, and audience

client_id and domain are REQUIRED. Your application needs some details about this client to communicate with Auth0.

audience is required unless you've explicitly set a default audience on your Auth0 tenantarrow-up-right.

You can get your client_id and domain the Settings section for your client in the Auth0 API dashboardarrow-up-right. Your audience is defined on your client's APIarrow-up-right.

Logout with new Auth0 tenants

Auth0 tenants created in 2018 and earlier had an optional tenant setting Enable Seamless SSO. This setting is automatically enabled for new tenants and cannot be disabled.

If enabled and a user logs out and logs back in a short while later, they will not need to re-enter their credentials. They'll be logged in automatically.

You can force Auth0 to present the login page:

  • Go to into the Tenant Settings > Advanced

  • In Allowed Logout URLs enter the allowed URL(s) you can redirect to, such as http://localhost:3000

Wherever you have a logout feature do two things: 1. run the logout command

  1. redirect the user to the Auth0 logout URL along with a returnTo parameter

Last updated