0
0
Firebasecloud~5 mins

GitHub sign-in in Firebase - Commands & Configuration

Choose your learning style9 modes available
Introduction
GitHub sign-in lets users log into your app using their GitHub account. This makes it easier for users because they don't need to create a new password for your app.
When you want to let users quickly access your app without creating a new account.
When your app targets developers who likely have GitHub accounts.
When you want to reduce password management and improve security by using GitHub's login system.
When you want to link user activity in your app to their GitHub identity.
When you want to simplify user registration and sign-in flows.
Config File - firebase.json
firebase.json
{
  "hosting": {
    "public": "public",
    "ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
  }
}

This file configures Firebase Hosting.

hosting.public: The folder with your web files.

Commands
Log into Firebase CLI with your Google account to manage your Firebase projects.
Terminal
firebase login
Expected OutputExpected
✔ Success! Logged in as your-email@example.com
Initialize Firebase Authentication in your project to enable sign-in methods like GitHub.
Terminal
firebase init auth
Expected OutputExpected
=== Authentication Setup === ✔ Authentication enabled ✔ GitHub provider enabled Firebase Authentication has been set up.
Deploy the authentication configuration to Firebase so GitHub sign-in is active.
Terminal
firebase deploy --only auth
Expected OutputExpected
=== Deploying to 'your-project-id'... ✔ Deploy complete! Project Console: https://console.firebase.google.com/project/your-project-id/overview
--only - Deploy only the specified Firebase feature, here 'auth' to update authentication settings.
Open the Firebase Console Authentication page in your browser to verify GitHub sign-in is enabled.
Terminal
firebase open auth
Expected OutputExpected
No output (command runs silently)
Key Concept

If you remember nothing else from this pattern, remember: enabling GitHub sign-in in Firebase lets users log in easily using their existing GitHub accounts without managing new passwords.

Common Mistakes
Not enabling GitHub sign-in in the Firebase Console after deploying.
Users won't see GitHub as a login option if it's not enabled in the console.
Always verify GitHub provider is enabled in the Firebase Console Authentication settings.
Not setting up OAuth credentials in GitHub Developer settings.
Firebase needs these credentials to connect your app with GitHub for sign-in.
Create OAuth app in GitHub, then enter Client ID and Secret in Firebase Console under GitHub sign-in.
Deploying without running 'firebase login' first.
You must be logged in to deploy changes to Firebase.
Run 'firebase login' before deploying to authenticate your CLI session.
Summary
Use 'firebase login' to authenticate your CLI with Firebase.
Run 'firebase init auth' to set up authentication including GitHub sign-in.
Deploy your auth settings with 'firebase deploy --only auth' to activate GitHub login.
Verify GitHub sign-in is enabled in the Firebase Console.