feat(api): add swagger docs, /api/user/me GET and PUT endpoints
This commit is contained in:
parent
77653bcc69
commit
29af2439c9
10 changed files with 2976 additions and 261 deletions
12
src/auth.ts
12
src/auth.ts
|
@ -113,6 +113,18 @@ export const { handlers, signIn, signOut, auth } = NextAuth({
|
|||
authorized({ auth }) {
|
||||
return !!auth?.user;
|
||||
},
|
||||
session: async ({ session, token }) => {
|
||||
if (session?.user) {
|
||||
session.user.id = token.sub as string;
|
||||
}
|
||||
return session;
|
||||
},
|
||||
jwt: async ({ user, token }) => {
|
||||
if (user) {
|
||||
token.uid = user.id;
|
||||
}
|
||||
return token;
|
||||
},
|
||||
},
|
||||
debug: process.env.NODE_ENV === 'development',
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue