Bird
Raised Fist0
Firebasecloud~20 mins

GitHub sign-in in Firebase - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
GitHub Sign-In Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ service_behavior
intermediate
2:00remaining
What happens after a successful GitHub sign-in with Firebase?

After a user signs in successfully using GitHub with Firebase Authentication, what is the immediate result in the Firebase system?

AFirebase deletes the user's GitHub account information after sign-in.
BThe user is redirected to the GitHub website to create a new account.
CThe user must manually verify their email address before Firebase creates a user record.
DThe user receives a Firebase ID token and a user record is created or updated in Firebase Authentication.
Attempts:
2 left
💡 Hint

Think about what Firebase Authentication does after a third-party sign-in.

❓ Configuration
intermediate
2:00remaining
Which Firebase configuration is required for GitHub sign-in?

To enable GitHub sign-in in Firebase Authentication, which configuration step is mandatory?

ARegister the GitHub OAuth client ID and client secret in the Firebase console under Authentication providers.
BAdd the GitHub repository URL to the Firebase Realtime Database rules.
CEnable GitHub sign-in by uploading a GitHub SSH key to Firebase Storage.
DConfigure a Firebase Cloud Function to listen for GitHub webhook events.
Attempts:
2 left
💡 Hint

Think about what OAuth credentials Firebase needs to connect with GitHub.

❓ security
advanced
2:00remaining
What is the best practice to secure GitHub OAuth credentials in Firebase?

When configuring GitHub sign-in in Firebase, how should you handle the OAuth client secret to keep it secure?

APublish the client secret in a public GitHub repository for transparency.
BInclude the client secret in the client app code to allow direct GitHub authentication.
CStore the client secret only in the Firebase console and never expose it in client-side code.
DSend the client secret as a URL parameter during sign-in requests.
Attempts:
2 left
💡 Hint

Consider where sensitive credentials should be stored to prevent leaks.

❓ Architecture
advanced
2:00remaining
How does Firebase handle user identity when linking GitHub sign-in with other providers?

If a user signs in with GitHub and later signs in with Google using Firebase Authentication, how does Firebase manage the user's identity?

AFirebase creates two separate user records for GitHub and Google sign-ins automatically.
BFirebase links both sign-in methods to a single user record if the developer explicitly links accounts.
CFirebase deletes the first user record when the second sign-in occurs.
DFirebase requires the user to create a new account for each provider.
Attempts:
2 left
💡 Hint

Think about how Firebase supports multiple sign-in methods for one user.

🧠 Conceptual
expert
2:00remaining
Why does Firebase require redirect URLs in GitHub OAuth setup?

When setting up GitHub sign-in with Firebase, why must you specify redirect URLs in the GitHub OAuth app settings?

ATo tell GitHub where to send the user after authentication so Firebase can complete sign-in securely.
BTo let GitHub bypass user consent screens during sign-in.
CTo enable Firebase to send emails to users after sign-in.
DTo allow GitHub to store user data in Firebase Realtime Database.
Attempts:
2 left
💡 Hint

Consider the OAuth flow and how the app receives the authentication response.

Practice

(1/5)
1. What is the main purpose of using GithubAuthProvider in Firebase authentication?
easy
A. To send emails to users
B. To store user data in Firebase database
C. To allow users to sign in using their GitHub accounts
D. To create a new GitHub repository

Solution

  1. Step 1: Understand the role of GithubAuthProvider

    GithubAuthProvider is a Firebase class that helps connect Firebase authentication with GitHub accounts.
  2. Step 2: Identify its main use

    It is used to let users sign in to your app using their GitHub login credentials.
  3. Final Answer:

    To allow users to sign in using their GitHub accounts -> Option C
  4. Quick Check:

    GithubAuthProvider = GitHub sign-in [OK]
Hint: GithubAuthProvider is for GitHub login only [OK]
Common Mistakes:
  • Confusing authentication with database storage
  • Thinking it sends emails
  • Assuming it manages GitHub repositories
2. Which of the following is the correct way to create a GitHub auth provider instance in Firebase JavaScript SDK?
easy
A. const provider = new GitHubAuth();
B. const provider = new GitAuthProvider();
C. const provider = new GithubProvider();
D. const provider = new GithubAuthProvider();

Solution

  1. Step 1: Recall the exact class name

    The Firebase SDK uses the class named GithubAuthProvider to create a GitHub auth provider.
  2. Step 2: Match the syntax

    The correct syntax to create an instance is new GithubAuthProvider().
  3. Final Answer:

    const provider = new GithubAuthProvider(); -> Option D
  4. Quick Check:

    Correct class name and syntax = const provider = new GithubAuthProvider(); [OK]
Hint: Class name is exactly GithubAuthProvider with capital G and A [OK]
Common Mistakes:
  • Misspelling the class name
  • Using incorrect capitalization
  • Using incomplete class names
3. What will happen when the following Firebase code runs successfully?
const provider = new GithubAuthProvider();
const result = await signInWithPopup(auth, provider);
console.log(result.user.email);
medium
A. It throws an error because signInWithPopup is not async
B. It logs the signed-in user's GitHub email address
C. It logs the user's GitHub password
D. It logs undefined because result has no user

Solution

  1. Step 1: Understand signInWithPopup behavior

    This function opens a popup for GitHub sign-in and returns a user credential object on success.
  2. Step 2: Access user email from result

    The result.user.email contains the authenticated user's email from GitHub.
  3. Final Answer:

    It logs the signed-in user's GitHub email address -> Option B
  4. Quick Check:

    signInWithPopup returns user info including email [OK]
Hint: signInWithPopup returns user info including email [OK]
Common Mistakes:
  • Thinking password is accessible
  • Assuming signInWithPopup is synchronous
  • Expecting result.user to be undefined
4. You wrote this code but get an error: signInWithPopup(auth, provider) is not a function. What is the most likely cause?
medium
A. You forgot to import signInWithPopup from Firebase auth module
B. You did not create a GitHub account
C. You used signInWithRedirect instead of signInWithPopup
D. You did not enable GitHub sign-in in Firebase console

Solution

  1. Step 1: Analyze the error message

    The error says signInWithPopup is not a function, meaning it is not recognized in the code.
  2. Step 2: Check imports

    This usually happens if signInWithPopup was not imported from Firebase auth module properly.
  3. Final Answer:

    You forgot to import signInWithPopup from Firebase auth module -> Option A
  4. Quick Check:

    Missing import causes function not found error [OK]
Hint: Always import functions you use from Firebase SDK [OK]
Common Mistakes:
  • Assuming GitHub account absence causes this error
  • Confusing signInWithPopup with signInWithRedirect
  • Ignoring Firebase console settings
5. You want to add GitHub sign-in to your Firebase app. Which steps must you complete before calling signInWithPopup(auth, provider)? Select the best sequence.
hard
A. Register OAuth app on GitHub, enable GitHub sign-in in Firebase console, create GithubAuthProvider instance
B. Create GithubAuthProvider instance, enable GitHub sign-in in Firebase console, register OAuth app on GitHub
C. Register OAuth app on GitHub, create GithubAuthProvider instance, enable GitHub sign-in in Firebase console
D. Enable GitHub sign-in in Firebase console, create GithubAuthProvider instance, register OAuth app on GitHub

Solution

  1. Step 1: Register OAuth app on GitHub

    You must register your app on GitHub to get client ID and secret for authentication.
  2. Step 2: Enable GitHub sign-in in Firebase console

    This step activates GitHub as a sign-in provider in your Firebase project.
  3. Step 3: Create GithubAuthProvider instance in your code

    After setup, create the provider instance to use in signInWithPopup.
  4. Final Answer:

    Register OAuth app on GitHub, enable GitHub sign-in in Firebase console, create GithubAuthProvider instance -> Option A
  5. Quick Check:

    Setup order matters: GitHub app, Firebase console, then code [OK]
Hint: Register on GitHub, enable in Firebase, then code [OK]
Common Mistakes:
  • Skipping enabling GitHub sign-in in Firebase
  • Not registering OAuth app on GitHub
  • Creating provider before setup steps
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard