Skip to content

Commit a886798

Browse files
robinjhuangDrJKL
andauthored
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 37975e4 commit a886798

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
@@ -60,10 +60,12 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
6060

6161
// Providers
6262
const googleProvider = new GoogleAuthProvider()
63+
googleProvider.addScope('email')
6364
googleProvider.setCustomParameters({
6465
prompt: 'select_account'
6566
})
6667
const githubProvider = new GithubAuthProvider()
68+
githubProvider.addScope('user:email')
6769
githubProvider.setCustomParameters({
6870
prompt: 'select_account'
6971
})

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)