From c7bbab53a6ec04d293f6a3abe6ff226b2c4b850e Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Thu, 18 Sep 2025 14:09:16 -0700 Subject: [PATCH] Explicitly add email scope for social auth login. (#5638) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Some users were authenticating successfully but their email addresses weren't being extracted from the Firebase token. This happened because we weren't explicitly requesting the email scope during OAuth authentication. While Firebase's default configuration includes basic profile info, it doesn't guarantee email access for all account types - particularly Google Workspace accounts with restrictive policies or users with privacy-conscious settings. [Github Scopes](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps) ## Changes Adding email scope for Google + Github social OAuth. ## Review Focus N/A ## Screenshots (if applicable) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5638-Explicitly-add-email-scope-for-social-auth-login-2726d73d3650817ab356fc9c04f8641b) by [Unito](https://www.unito.io) --------- Co-authored-by: Alexander Brown --- src/stores/firebaseAuthStore.ts | 2 ++ tests-ui/tests/store/firebaseAuthStore.test.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/stores/firebaseAuthStore.ts b/src/stores/firebaseAuthStore.ts index 65b468001..7d722c345 100644 --- a/src/stores/firebaseAuthStore.ts +++ b/src/stores/firebaseAuthStore.ts @@ -61,10 +61,12 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => { // Providers const googleProvider = new GoogleAuthProvider() + googleProvider.addScope('email') googleProvider.setCustomParameters({ prompt: 'select_account' }) const githubProvider = new GithubAuthProvider() + githubProvider.addScope('user:email') githubProvider.setCustomParameters({ prompt: 'select_account' }) diff --git a/tests-ui/tests/store/firebaseAuthStore.test.ts b/tests-ui/tests/store/firebaseAuthStore.test.ts index ffe7a8d99..d37c3857a 100644 --- a/tests-ui/tests/store/firebaseAuthStore.test.ts +++ b/tests-ui/tests/store/firebaseAuthStore.test.ts @@ -58,9 +58,11 @@ vi.mock('firebase/auth', async (importOriginal) => { onAuthStateChanged: vi.fn(), signInWithPopup: vi.fn(), GoogleAuthProvider: class { + addScope = vi.fn() setCustomParameters = vi.fn() }, GithubAuthProvider: class { + addScope = vi.fn() setCustomParameters = vi.fn() }, setPersistence: vi.fn().mockResolvedValue(undefined)