Skip to content

Commit

Permalink
fix: Use sub instead of email for google entity ID (#9949)
Browse files Browse the repository at this point in the history
  • Loading branch information
sradevski authored Nov 7, 2024
1 parent 242d00b commit cd578e8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-dots-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/auth-google": patch
---

fix: Use sub instead of email for google entity ID
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe("Google auth provider", () => {
return {
provider_identities: [
{
entity_id: "[email protected]",
entity_id: "113664482950786663866",
provider: "google",
},
],
Expand All @@ -180,7 +180,7 @@ describe("Google auth provider", () => {
authIdentity: {
provider_identities: [
{
entity_id: "[email protected]",
entity_id: "113664482950786663866",
provider: "google",
},
],
Expand All @@ -194,7 +194,7 @@ describe("Google auth provider", () => {
return {
provider_identities: [
{
entity_id: "[email protected]",
entity_id: "113664482950786663866",
provider: "google",
},
],
Expand Down Expand Up @@ -222,7 +222,7 @@ describe("Google auth provider", () => {
authIdentity: {
provider_identities: [
{
entity_id: "[email protected]",
entity_id: "113664482950786663866",
provider: "google",
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit cd578e8

Please sign in to comment.