how to update the type of session in session callback? #2979
-
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 12 replies
-
https://next-auth.js.org/getting-started/typescript#module-augmentation |
Beta Was this translation helpful? Give feedback.
-
Add the following {
.
.
.
"include": ["next-env.d.ts", "types/**/*.ts", "**/*.ts", "**/*.tsx"],
.
.
.
} Then add the following for types/next-auth.d.tsimport NextAuth from "next-auth"
declare module "next-auth" {
/**
* Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
*/
interface Session {
user: {
/** The user's name. */
name: string
}
}
} |
Beta Was this translation helpful? Give feedback.
-
Hi, I am also facing an issue. I have created a API and after login its returning id, email, and accessToken but I'm unable to set the accessToken in next-auth session as well as jwt token in next auth |
Beta Was this translation helpful? Give feedback.
-
I have a similar issue. the problem is the next one: |
Beta Was this translation helpful? Give feedback.
-
How did you solved the error regarding |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Add the following
types/**/*.ts
intsconfig.json
:Then add the following for
session.user
.types/next-auth.d.ts