fix: Use sub instead of email for google entity ID (#9949)

This commit is contained in:
Stevche Radevski
2024-11-07 09:24:14 +01:00
committed by GitHub
parent 242d00b567
commit cd578e89ff
3 changed files with 10 additions and 6 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/auth-google": patch
---
fix: Use sub instead of email for google entity ID

View File

@@ -155,7 +155,7 @@ describe("Google auth provider", () => {
return {
provider_identities: [
{
entity_id: "test@admin.com",
entity_id: "113664482950786663866",
provider: "google",
},
],
@@ -180,7 +180,7 @@ describe("Google auth provider", () => {
authIdentity: {
provider_identities: [
{
entity_id: "test@admin.com",
entity_id: "113664482950786663866",
provider: "google",
},
],
@@ -194,7 +194,7 @@ describe("Google auth provider", () => {
return {
provider_identities: [
{
entity_id: "test@admin.com",
entity_id: "113664482950786663866",
provider: "google",
},
],
@@ -222,7 +222,7 @@ describe("Google auth provider", () => {
authIdentity: {
provider_identities: [
{
entity_id: "test@admin.com",
entity_id: "113664482950786663866",
provider: "google",
},
],

View File

@@ -142,8 +142,7 @@ export class GoogleAuthService extends AbstractAuthModuleProvider {
)
}
// TODO: We should probably use something else than email here, like the `sub` field (which is more constant than the email)
const entity_id = payload.email
const entity_id = payload.sub
const userMetadata = {
name: payload.name,
picture: payload.picture,