How to add scope for additional details of GitHub (Sign In) user in firebase

I've implemented GitHub login for my app using firebase. I'm able to get email, UID and other details for logged in user. But the DisplayName is empty.

Can anyone let me know how to get the displayName from GitHub.

Thanks in advance...

1 answer

  • answered 2019-05-22 17:26 bojeil

    You can get all GitHub user profile data immediately after sign-in, via AdditionalUserInfo.

    Here is an example with the web API:

    firebase.auth().signInWithPopup(new firebase.auth.GithubAuthProvider())
      .then((userCredential) => {
        // Get the GitHub username.
        console.log(userCredential.additionalUserInfo.username);
        // Get GitHub additional user profile.
        console.log(userCredential.additionalUserInfo.profile);
      })
      .catch((error) => {
        // An error occurred.
      });