Skip to content

Commit

Permalink
fix(auth): append user id for session
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Sep 4, 2024
1 parent 92fed33 commit b41a35f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions apps/core/src/modules/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,10 @@ export class AuthService {
},
{
projection: {
_id: 0,
access_token: 0,
providerAccountId: 1,
provider: 1,
type: 1,
userId: 1,
},
},
)
Expand All @@ -254,7 +256,6 @@ export class AuthService {
},
{
projection: {
_id: 0,
email: 1,
name: 1,
image: 1,
Expand All @@ -263,10 +264,13 @@ export class AuthService {
},
)

Object.assign(account, user)
if (user) Object.assign(account, user)
}

return account
return {
...account,
id: account?.userId.toString(),
}
}
getOauthProviders() {
return this.authConfig.providers.map((p) => p.name)
Expand Down

0 comments on commit b41a35f

Please sign in to comment.