Skip to content
Discussion options

You must be logged in to vote

If I understand correctly, you want to save the user's role into the session? If so, then yes I have but with a little different approach. I didn't even know you could use it like this, although I am using prisma 😅

Here is the simplified code:

Provider

CredentialsProvider({
        name: "Credentials",
        credentials: {
          username: { label: "Email", type: "text", placeholder: "Email" },
          password: { label: "Password", type: "password" },
        },
        async authorize(credentials, req) {
          let tempUser = await FindUser({          <-- function that uses prisma to query db, which also gives the role
            email: credentials?.["email"],               <…

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@MatD1
Comment options

@zanzlender
Comment options

@MatD1
Comment options

@zanzlender
Comment options

@MatD1
Comment options

Answer selected by MatD1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants