From a886798a10b51023f7ea6714895ad27776751ae4 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 f2c75417c..6e4974839 100644 --- a/src/stores/firebaseAuthStore.ts +++ b/src/stores/firebaseAuthStore.ts @@ -60,10 +60,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 fee66d3f7..ef8ffe0bd 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)