Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: "test@admin.com",
entity_id: "113664482950786663866",
provider: "google",
},
],
Expand All @@ -180,7 +180,7 @@ describe("Google auth provider", () => {
authIdentity: {
provider_identities: [
{
entity_id: "test@admin.com",
entity_id: "113664482950786663866",
provider: "google",
},
],
Expand All @@ -194,7 +194,7 @@ describe("Google auth provider", () => {
return {
provider_identities: [
{
entity_id: "test@admin.com",
entity_id: "113664482950786663866",
provider: "google",
},
],
Expand Down Expand Up @@ -222,7 +222,7 @@ describe("Google auth provider", () => {
authIdentity: {
provider_identities: [
{
entity_id: "test@admin.com",
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
Loading