mirror of
https://github.com/better-auth/better-auth.git
synced 2026-06-04 05:16:36 -05:00
fix: mapProfileToUser getting called twice during idToken login
This commit is contained in:
@@ -263,14 +263,7 @@ export const signInSocial = createAuthEndpoint(
|
||||
message: BASE_ERROR_CODES.FAILED_TO_GET_USER_INFO,
|
||||
});
|
||||
}
|
||||
const mapProfileToUser = await provider.options?.mapProfileToUser?.(
|
||||
userInfo.user,
|
||||
);
|
||||
const userData = {
|
||||
...userInfo.user,
|
||||
...mapProfileToUser,
|
||||
};
|
||||
if (!userData.email) {
|
||||
if (!userInfo.user.email) {
|
||||
c.context.logger.error("User email not found", {
|
||||
provider: c.body.provider,
|
||||
});
|
||||
@@ -280,12 +273,12 @@ export const signInSocial = createAuthEndpoint(
|
||||
}
|
||||
const data = await handleOAuthUserInfo(c, {
|
||||
userInfo: {
|
||||
...userData,
|
||||
email: userData.email,
|
||||
id: userData.id,
|
||||
name: userData.name || "",
|
||||
image: userData.image,
|
||||
emailVerified: userData.emailVerified || false,
|
||||
...userInfo.user,
|
||||
email: userInfo.user.email,
|
||||
id: userInfo.user.id,
|
||||
name: userInfo.user.name || "",
|
||||
image: userInfo.user.image,
|
||||
emailVerified: userInfo.user.emailVerified || false,
|
||||
},
|
||||
account: {
|
||||
providerId: provider.id,
|
||||
|
||||
Reference in New Issue
Block a user