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
+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/auth-google": patch
---
fix: Use sub instead of email for google entity ID
@@ -155,7 +155,7 @@ describe("Google auth provider", () => {
return { return {
provider_identities: [ provider_identities: [
{ {
entity_id: "test@admin.com", entity_id: "113664482950786663866",
provider: "google", provider: "google",
}, },
], ],
@@ -180,7 +180,7 @@ describe("Google auth provider", () => {
authIdentity: { authIdentity: {
provider_identities: [ provider_identities: [
{ {
entity_id: "test@admin.com", entity_id: "113664482950786663866",
provider: "google", provider: "google",
}, },
], ],
@@ -194,7 +194,7 @@ describe("Google auth provider", () => {
return { return {
provider_identities: [ provider_identities: [
{ {
entity_id: "test@admin.com", entity_id: "113664482950786663866",
provider: "google", provider: "google",
}, },
], ],
@@ -222,7 +222,7 @@ describe("Google auth provider", () => {
authIdentity: { authIdentity: {
provider_identities: [ provider_identities: [
{ {
entity_id: "test@admin.com", entity_id: "113664482950786663866",
provider: "google", provider: "google",
}, },
], ],
@@ -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.sub
const entity_id = payload.email
const userMetadata = { const userMetadata = {
name: payload.name, name: payload.name,
picture: payload.picture, picture: payload.picture,