---
Guides you through interactive Auth0 OAuth setup from tenant creation to environment variables.
/plugin marketplace add varaku1012/aditi.code/plugin install auth0-oauth-plugin@aditi-code-pluginsInteractive guided setup for Auth0 authentication from scratch.
/oauth-setup-auth0
This will walk you through:
If you don't have an Auth0 account:
mycompany.auth0.comWhat you'll get:
YOUR_DOMAIN.auth0.comChoose based on your tech stack:
For: React, Vue, Angular, Svelte, Next.js (client-side)
Characteristics:
Setup:
Auth0 Dashboard → Applications → Create Application
Name: My React App
Type: Single Page Application
Settings:
- Allowed Callback URLs: http://localhost:3000/callback
- Allowed Logout URLs: http://localhost:3000
- Allowed Web Origins: http://localhost:3000
- Token Endpoint Authentication: None
For: Next.js, Express, Django, Rails (with server)
Characteristics:
Setup:
Auth0 Dashboard → Applications → Create Application
Name: My Next.js App
Type: Regular Web Applications
Settings:
- Allowed Callback URLs: http://localhost:3000/api/auth/callback
- Allowed Logout URLs: http://localhost:3000
- Token Endpoint Authentication: Post
- Secret: [Auto-generated, copy to .env]
For: Backend services, scheduled jobs, CLI tools
Characteristics:
Setup:
Auth0 Dashboard → Applications → Create Application
Name: My Backend Service
Type: Machine-to-Machine Applications
Settings:
- Grant Types: client_credentials
- Audience: https://YOUR_DOMAIN/api/v2/
- Secret: [Auto-generated, copy to .env]
For: iOS, Android, React Native apps
Characteristics:
Setup:
Auth0 Dashboard → Applications → Create Application
Name: My Mobile App
Type: Native
Settings:
- Allowed Callback URLs: com.myapp://callback
- Allowed Logout URLs: com.myapp://logout
- Token Endpoint Authentication: None
Choose how users authenticate:
Built-in Auth0 database
Enable:
Auth0 Dashboard → Connections → Database → Username-Password-Authentication
Settings:
- Allow Signup: Yes (if you want user self-registration)
- Require Email Verification: Yes
- Password Policy: Good (mixed case, numbers, symbols)
- Disable signup for: [Your application]
Usage:
Users can sign up at: YOUR_DOMAIN/signup
Or you create users via API
Let users login with Google, GitHub, etc.
Create Google Cloud project:
Create OAuth credentials:
https://YOUR_DOMAIN/login/callbackhttps://YOUR_DOMAIN/login/callback?connection=google-oauth2Add to Auth0:
Auth0 Dashboard → Connections → Social → Google
Client ID: [Paste from Google Cloud]
Client Secret: [Paste from Google Cloud]
Enable for: [Your application]
Create GitHub OAuth App:
https://YOUR_DOMAIN/login/callbackAdd to Auth0:
Auth0 Dashboard → Connections → Social → GitHub
Client ID: [Paste from GitHub]
Client Secret: [Paste from GitHub]
Enable for: [Your application]
For company employees using company email
Setup Active Directory:
Auth0 Dashboard → Connections → Enterprise → Active Directory/LDAP
Name: Company AD
LDAP URL: ldap://ad.company.com:389
Bind DN: admin@company.com
Bind Password: [AD admin password]
Base DN: cn=users,dc=company,dc=com
Mapping:
- Email: mail
- Name: displayName
- Username: sAMAccountName
Enable for: [Your application]
Result: Users can login with company credentials, no password duplication
If your frontend needs to call protected APIs:
Auth0 Dashboard → APIs → Create API
Name: My API
Identifier: https://api.myapp.com
Signing Algorithm: RS256
Scopes:
+ read:items (Read access to items)
+ write:items (Write access to items)
+ delete:items (Delete items)
+ admin (Full admin access)
Usage in App:
// Request these scopes during login
Auth0Provider({
authorizationParams: {
scope: 'openid profile email read:items write:items'
}
})
// Access token will include these scopes
// Backend validates scopes before allowing access
Auth0 Dashboard → Connections → Authenticators
Enable:
- Google Authenticator ✅
- SMS (optional)
- Email OTP
For application:
- Require MFA: Yes / No / Per-user rule
Optional: Require MFA for certain users:
// Auth0 Rule: Enforce MFA for admin users
module.exports = function(user, context, callback) {
if (user.email.endsWith('@admin.company.com')) {
context.multifactor = {
provider: 'google-authenticator',
allowRememberBrowser: false
}
}
callback(null, user, context)
}
Auth0 Dashboard → Applications → Settings → Advanced
Token Settings:
- ID Token Expiration: 36000 (10 hours)
- Access Token Expiration: 600 (10 minutes) ← IMPORTANT
- Refresh Token Expiration: 2592000 (30 days)
- Refresh Token Rotation: Enabled ✅
Why short access token?
Auth0 Dashboard → Applications → Settings
Allowed Callback URLs:
- Production: https://myapp.com/callback ✅
- Staging: https://staging.myapp.com/callback ✅
- Local dev: http://localhost:3000/callback (only for dev)
Allowed Logout URLs:
- Production: https://myapp.com ✅
- Staging: https://staging.myapp.com ✅
- Local dev: http://localhost:3000 (only for dev)
Based on your setup, create .env.local:
# Auth0 Configuration
AUTH0_DOMAIN=YOUR_DOMAIN.auth0.com
AUTH0_CLIENT_ID=YOUR_CLIENT_ID
AUTH0_CLIENT_SECRET=YOUR_CLIENT_SECRET
AUTH0_CALLBACK_URL=http://localhost:3000/callback
# For Next.js
AUTH0_BASE_URL=http://localhost:3000
AUTH0_SECRET=use [node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"]
# For APIs
AUTH0_AUDIENCE=https://api.myapp.com
AUTH0_SCOPE=openid profile email read:items
# API Configuration
API_URL=http://localhost:3001
View users:
Auth0 Dashboard → User Management → Users
View logs:
Auth0 Dashboard → Logs (Real-time logs of auth events)
View rules:
Auth0 Dashboard → Rules (Custom logic for auth flow)
Reset user password:
Auth0 Dashboard → Users → Select user → Actions → Reset password
After setup completes:
Install SDK for your framework:
/oauth-implement react/oauth-implement nextjs/oauth-implement nodejsRun security audit:
/oauth-security-auditTest your implementation:
Deploy to production:
Q: Callback URL mismatch error? A: Ensure your callback URL in Auth0 exactly matches redirect_uri in your app (including http/https and port)
Q: Connection not showing in login? A: Check that connection is enabled for your application (Connections → Select connection → Applications toggle)
Q: Can't create users via signup? A: Ensure "Allow Signup" is enabled in Database connection settings
Q: Users can't login with social connection? A: Verify social connection is enabled for your application
Status: Setup wizard complete!
Next command: /oauth-implement [framework] to add auth to your app