Next.js Discord

Discord Forum

What exactly does Next auth do with the user object in CredentialsProvider authorize function?

Unanswered
Egyptian Mau posted this in #help-forum
Open in Discord
Egyptian MauOP
I am using the CredentialsProvider with a node backend that returns the following object:

user: {
    _id: '65ba2e8ffd668a4926e2e0ff',
    name: 'Redacted,
    email: 'redacted@gmail.com',
    date: '2024-01-31T11:24:29.538Z',
    __v: 0
  },
  token: 'JWT TOKEN WILL BE HERE'


So what exactly does next auth expect me to return now, I understand that it wants the user data so returning user would make sense, but what happens with the token, and how can I grab it later to verify it?

2 Replies

Egyptian MauOP
In the expected return type I dont see token at all, so where does it go?

export interface User {
id?: string
name?: string | null
email?: string | null
image?: string | null
}
Egyptian MauOP
Push