0
0
Firebasecloud~10 mins

GitHub sign-in in Firebase - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize GitHub sign-in provider.

Firebase
const provider = new firebase.auth.[1]();
Drag options to blanks, or click blank then click option'
AGitHubAuthProvider
BFacebookAuthProvider
CGoogleAuthProvider
DTwitterAuthProvider
Attempts:
3 left
💡 Hint
Common Mistakes
Using GoogleAuthProvider instead of GitHubAuthProvider
Misspelling the provider name
2fill in blank
medium

Complete the code to sign in with a popup using the GitHub provider.

Firebase
firebase.auth().signInWith[1](provider).then(result => {
  // handle result
});
Drag options to blanks, or click blank then click option'
AEmailAndPassword
BRedirect
CPopup
DCredential
Attempts:
3 left
💡 Hint
Common Mistakes
Using signInWithRedirect instead of signInWithPopup
Using incorrect method names
3fill in blank
hard

Fix the error in the code to get the GitHub access token from the sign-in result.

Firebase
const credential = [1].credentialFromResult(result);
const token = credential.accessToken;
Drag options to blanks, or click blank then click option'
Afirebase.auth.GitHubAuthProvider
Bfirebase
Cfirebase.auth
Dauth
Attempts:
3 left
💡 Hint
Common Mistakes
Calling credentialFromResult on result.auth
Using incorrect namespaces
4fill in blank
hard

Fill both blanks to request additional GitHub scopes and handle sign-in errors.

Firebase
provider.[1]('repo');
firebase.auth().signInWithPopup(provider).catch(error => {
  const errorCode = error.[2];
  // handle error
});
Drag options to blanks, or click blank then click option'
AaddScope
Bcode
Cmessage
DerrorCode
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'errorCode' or 'message' instead of 'code'
Using 'addScopes' instead of 'addScope'
5fill in blank
hard

Fill all three blanks to create a user object from the GitHub sign-in result.

Firebase
const user = {
  id: result.user.[1],
  name: result.user.[2],
  email: result.user.[3]
};
Drag options to blanks, or click blank then click option'
Auid
BdisplayName
Cemail
DphotoURL
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'id' instead of 'uid'
Using 'name' instead of 'displayName'