getServerAuthSession returns null when using CredentialsProvider

i just started a new t3 app using the app router. i added just this to the providers array in the authOptions
CredentialsProvider({
name: 'username and password',
credentials: {
username: { label: 'username', type: 'text' },
password: { label: 'password', type: 'password' },
},
async authorize(credentials, req) {
return { id: '1234', name: 'John Doe', email: '[email protected]' }
},
}),
CredentialsProvider({
name: 'username and password',
credentials: {
username: { label: 'username', type: 'text' },
password: { label: 'password', type: 'password' },
},
async authorize(credentials, req) {
return { id: '1234', name: 'John Doe', email: '[email protected]' }
},
}),
thats the only change i made to the t3 generated boilerplate. if i go to /api/auth/signin, and even if i call the signIn function with 'credentials' as the first argument, it returns ok true, error null, and the next-auth.* cookies are being created. so it seems to be working fine, but getServerAuthSession inside server components still returns null always. if i login with discord instead, it works fine, and getServerAuthSession returns an object. so, any idea why? do i need to setup something else to make the credentials provider work?
1 Reply
mis
misOP10mo ago
the client side function getSession also returns null actually, the jwt token cookie is not being created, only the other two, my bad
Want results from more Discord servers?
Add your server