Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nuxt-alt/auth/llms.txt

Use this file to discover all available pages before exploring further.

The Auth0 provider configures @nuxt-alt/auth to authenticate users through your Auth0 tenant. It uses the dedicated auth0 scheme, which extends the OAuth2 scheme with Auth0-specific behaviour such as tenant-scoped endpoint resolution and support for the audience parameter required by Auth0 API authorization. All endpoint URLs are derived automatically from the domain you provide, so the only required options are your tenant domain and client ID.

Required Options

OptionTypeDescription
domainstringYour Auth0 tenant domain, e.g. your-tenant.auth0.com
clientIdstringThe Client ID of your Auth0 application

Configuration

export default defineNuxtConfig({
  auth: {
    strategies: {
      auth0: {
        domain: 'your-tenant.auth0.com',
        clientId: 'YOUR_CLIENT_ID',
        // Optional: restrict access token audience to a specific API
        audience: 'https://your-api.example.com',
        // Optional: override the default scopes
        scope: ['openid', 'profile', 'email'],
      },
    },
  },
})

Auto-Configured Defaults

When the strategy name is auth0, the provider automatically sets the following values. Any property you specify in your own config takes precedence.
PropertyAuto-Configured Value
scheme'auth0'
endpoints.authorizationhttps://{domain}/authorize
endpoints.userInfohttps://{domain}/userinfo
endpoints.tokenhttps://{domain}/oauth/token
endpoints.logouthttps://{domain}/v2/logout
scope['openid', 'profile', 'email']
token.property'access_token'
token.type'Bearer'
token.name'Authorization'
idToken.property'id_token'
refreshToken.property'refresh_token'
responseType'token'

Logging In

Once configured, trigger the Auth0 login redirect from any component or composable using the loginWith method:
const auth = useAuth()
await auth.loginWith('auth0')
The user will be redirected to the Auth0 Universal Login page. After successful authentication Auth0 redirects back to your application’s callback route (default: /login), where @nuxt-alt/auth automatically exchanges the code for tokens and fetches the user profile from the userinfo endpoint.
You must add your application’s callback URL to the Allowed Callback URLs list in the Auth0 dashboard under Application Settings. The default callback route used by @nuxt-alt/auth is /login. If you have customised redirect.callback in your auth config, use that path instead.

Build docs developers (and LLMs) love