Merge branch 'feature/auth-troubleshooting' into develop

This commit is contained in:
Knee Cola
2025-11-25 20:05:56 +01:00

View File

@@ -35,8 +35,12 @@ export const authConfig: NextAuthConfig = {
// see: https://stackoverflow.com/questions/70409219/get-user-id-from-session-in-next-auth-client
jwt({ token, account, user }) {
if (account) {
token.accessToken = account.access_token
token.id = user?.id
// console.log("(jwt) account:", account);
// console.log("(jwt) user:", user);
token.accessToken = account.access_token;
// attach Google account ID to the token
token.piggyback_providerAccountId = account.providerAccountId;
}
return token
},
@@ -45,7 +49,9 @@ export const authConfig: NextAuthConfig = {
// see: https://stackoverflow.com/questions/70409219/get-user-id-from-session-in-next-auth-client
async session({ session, token }:{ session:Session, token:any }) {
if(session.user && token) {
session.user.id = token.id;
// assign Google account ID from the token to the Session user ID
session.user.id = token.piggyback_providerAccountId;
// console.log("(jwt) token:", token);
}
return session;
},