fix: lowercase OAuth handle to prevent duplicate connected accounts (#21120)

Google and Microsoft connect flows stored the provider-returned email
verbatim, so a re-auth with different casing (Sam@ vs sam@) missed the
existing-account lookup and created a duplicate. Normalize the handle to
lowercase at extraction, matching the SSO controller.

Note: not doing backfill for now
This commit is contained in:
neo773
2026-06-02 14:57:10 +05:30
committed by GitHub
parent 7d7f32b243
commit 1ba7a3fa54
2 changed files with 2 additions and 2 deletions
@@ -96,7 +96,7 @@ export class GoogleAPIsAuthController {
id: workspaceId,
});
const handle = emails[0].value;
const handle = emails[0].value.toLowerCase();
const connectedAccountId =
await this.googleAPIsService.refreshGoogleRefreshToken({
@@ -103,7 +103,7 @@ export class MicrosoftAPIsAuthController {
);
}
const handle = emails[0].value;
const handle = emails[0].value.toLowerCase();
const connectedAccountId =
await this.microsoftAPIsService.refreshMicrosoftRefreshToken({