Auth Module
1.0.0
1.0.0
  • README
  • docs
    • providers
      • GitHub
      • Google
      • Auth0
      • Laravel Passport
      • Facebook
    • Auth Module
    • Migration Guide
    • guide
      • Middleware
      • Providers
      • Setup
      • Schemes
    • recipes
      • Extending Auth plugin
    • api
      • API
      • options
      • storage
      • auth
    • schemes
      • Local
      • Oauth2
    • glossary
  • .github
    • ISSUE_TEMPLATE
  • CHANGELOG
Powered by GitBook
On this page
  • Usage
  • Obtaining client_id, domain, and audience
  • Logout with new Auth0 tenants
  1. docs
  2. providers

Auth0

PreviousGoogleNextLaravel Passport

Last updated 5 years ago

is a great authentication-as-a-service platform for free!

A is available as well as the .

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:

Obtaining client_id, domain, and audience

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

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

this.$auth.logout()
  1. redirect the user to the Auth0 logout URL along with a returnTo parameter

    https://mytenant.auth0.com/v2/logout?returnTo=http%3A%2F%2Flocalhost:3000

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

audience is required unless you've explicitly set a default audience .

You can get your client_id and domain the Settings section for your client in the . Your audience is defined on your .

oauth2 scheme
on your Auth0 tenant
Auth0 API dashboard
client's API
Source Code
Auth0
live demo
source