Skip to content

Commit c7bbab5

Browse files
robinjhuangDrJKL
authored andcommitted
Explicitly add email scope for social auth login. (#5638)
## 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 <[email protected]>
1 parent 33b6df5 commit c7bbab5

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/stores/firebaseAuthStore.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
6161

6262
// Providers
6363
const googleProvider = new GoogleAuthProvider()
64+
googleProvider.addScope('email')
6465
googleProvider.setCustomParameters({
6566
prompt: 'select_account'
6667
})
6768
const githubProvider = new GithubAuthProvider()
69+
githubProvider.addScope('user:email')
6870
githubProvider.setCustomParameters({
6971
prompt: 'select_account'
7072
})

tests-ui/tests/store/firebaseAuthStore.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ vi.mock('firebase/auth', async (importOriginal) => {
5858
onAuthStateChanged: vi.fn(),
5959
signInWithPopup: vi.fn(),
6060
GoogleAuthProvider: class {
61+
addScope = vi.fn()
6162
setCustomParameters = vi.fn()
6263
},
6364
GithubAuthProvider: class {
65+
addScope = vi.fn()
6466
setCustomParameters = vi.fn()
6567
},
6668
setPersistence: vi.fn().mockResolvedValue(undefined)

0 commit comments

Comments
 (0)