I am currently building a login system for an application I am developing, using YouTube accounts via Google Oauth for login with Firebase. However, when I add the youtube readonly scope:
import {getAuth, signInWithPopup} from "firebase/auth";async function loginGoogle(){ const auth = getAuth(); const provider = new GoogleAuthProvider(); provider.addScope('https://www.googleapis.com/auth/youtube.readonly'); const result = await signInWithPopup(auth,provider); console.log(result);}loginGoogle();When I look at the output of my result, I will find an email such as:
email: "myYouTubeName-1234@pages.plusgoogle.com"
When in reality, I want the email of the gmail account that I logged in with instead, such as SomeOtherName@gmail.com.
This is only an issue when logging in to brand accounts.
Is there an additional Google endpoint that I can pass my accessToken to that will give me the proper email? Or how can I receive the "parent" email of a brand account when logging in with the youtube.readonly scope?
Thanks!