You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We will configure NextAuth to conditionally load either CredentialsProvider or Auth0Provider. When AUTH_METHOD=auth0, the app will use Auth0’s Universal Login to authenticate users. We also need to sync user data into Supabase (or at least ensure a user record exists) so that features like roles and collaboration remain consistent.
Goals & Scope
Conditionally Add Auth0 Provider based on AUTH_METHOD.
Use Universal Login flow (redirect to Auth0, then callback).
Create/Update Supabase user records upon successful Auth0 login.
Retain Credentials approach when AUTH_METHOD=credentials is set.
Detailed Tasks
Auth0 Environment Variables
Accept AUTH0_CLIENT_ID, AUTH0_CLIENT_SECRET, and AUTH0_ISSUER_BASE_URL.
Set AUTH_METHOD=auth0 to enable Auth0 in NextAuthOptions.
NextAuth Configuration
In [...nextauth]/route.ts, conditionally add Auth0Provider(...) if AUTH_METHOD=auth0.
Remove or comment out any ROPG logic—we are using Universal Login.
User Sync to Supabase
Within callbacks.signIn or callbacks.jwt, check if the Auth0 user (via profile or token) already exists in Supabase.
If not, create a Supabase user record with the relevant fields (email, name, etc.).
Decide if we only sync basic info (name, email) or also handle roles/status.
Testing & Verification
Manual test by setting AUTH_METHOD=auth0 locally.
Confirm you can log in via Auth0’s hosted page.
Confirm a new record appears in Supabase upon first-time login.
Fallback to Credentials
When AUTH_METHOD=credentials, verify that the existing login and sign-up flows continue working.
Acceptance Criteria
Auth0Provider is successfully added to NextAuth when AUTH_METHOD=auth0.
Logging in via Auth0’s Universal Login flow creates/updates Supabase user data.
No conflicts with the Credentials-based logic when AUTH_METHOD=credentials.
Relevant environment variables (AUTH0_CLIENT_ID, etc.) are documented or at least recognized in code.
The text was updated successfully, but these errors were encountered:
We will configure NextAuth to conditionally load either CredentialsProvider or Auth0Provider. When
AUTH_METHOD=auth0
, the app will use Auth0’s Universal Login to authenticate users. We also need to sync user data into Supabase (or at least ensure a user record exists) so that features like roles and collaboration remain consistent.Goals & Scope
AUTH_METHOD
.AUTH_METHOD=credentials
is set.Detailed Tasks
Auth0 Environment Variables
AUTH0_CLIENT_ID
,AUTH0_CLIENT_SECRET
, andAUTH0_ISSUER_BASE_URL
.AUTH_METHOD=auth0
to enable Auth0 inNextAuthOptions
.NextAuth Configuration
[...nextauth]/route.ts
, conditionally addAuth0Provider(...)
ifAUTH_METHOD=auth0
.User Sync to Supabase
callbacks.signIn
orcallbacks.jwt
, check if the Auth0 user (via profile or token) already exists in Supabase.Testing & Verification
AUTH_METHOD=auth0
locally.Fallback to Credentials
AUTH_METHOD=credentials
, verify that the existing login and sign-up flows continue working.Acceptance Criteria
Auth0Provider
is successfully added to NextAuth whenAUTH_METHOD=auth0
.AUTH_METHOD=credentials
.AUTH0_CLIENT_ID
, etc.) are documented or at least recognized in code.The text was updated successfully, but these errors were encountered: