Next-Auth CredentialsProvider not working as intended
Not sure how to use CredentialsProvider properly
11 Replies
This is my code for the autorize function:
The user exists, it is returned, but the session state is never updated. What I'm trying to achieve, is that a user can log in with an oauth provider normally, or by providing a key (thats like a backup login)
Each user in the db has a additional filed called "key" where their secret login key is stored
But the
session
is never updated, it's still null
, even though I'm returning the user object.Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
no
I'm using postgres & prisma for my db
don't they contradict each other?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
hm I see, is there a solution to achieve what I'm trying to do?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Yeah
next-auth
is super opinionated about using password credentials for good reasons but still quite annoying
So you have to use the jwt
strategy to even use it and then you have to deal with the credentials func and the session/token funcs tooif I turn the strategy to jwt, will I still be able to use oauth logins?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
in terms of underlying infrastructure, what are the sort of things that will change when I switch to a jwt strategy?
Like will I still have the User information saved to the db? Where will sessions be stored? Is there a part of the docs that explain this well? (couldn't find any good resource that compared the two strategies)
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View