NextAuth: Cannot login with CredentialsProvider

I'm currently developing my web app using the full-featured t3 app, and I don't want to connect to the real provider while developing. (Since there are roles and it's much better if I can switch my role during development directly on my UI) According to the answer of the following GitHub issue and a side note from t3-app docs, I added a credential provider in the authOptions object inside src/api/auth/[...nextauth].ts with some hardcoded users. https://github.com/nextauthjs/next-auth/issues/5587 But now I found that after the login succeeded, it refreshed my page and my app just kept being in the not logged-in state. (The next-auth.session-token cookies does appear, but gone after the refresh) Am I doing anything wrong? How could I fix this?
// ...the other providers
CredentialsProvider({
credentials: {
role: {
type: "text",
label: "Role",
},
},
authorize: (credentials) => {
if (!credentials) return null;

const mockUser = mockUsers[credentials.role];
return mockUser ?? null;
},
}),
// ...the other providers
CredentialsProvider({
credentials: {
role: {
type: "text",
label: "Role",
},
},
authorize: (credentials) => {
if (!credentials) return null;

const mockUser = mockUsers[credentials.role];
return mockUser ?? null;
},
}),
GitHub
new provider - Mock · Issue #5587 · nextauthjs/next-auth
Description 📓 Today we are using an AzureAd provider, which requires the use of clientid/secret information. We would prefer not to have to share this will all possible internal developers for an i...
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server