Configure Authentication providers using the Firebase CLI

The Firebase CLI lets you enable and configure Authentication providers for your Firebase project using the firebase.json configuration file. This lets you manage your Authentication setup as code and deploy it alongside your other Firebase assets.

Step 1: Set up Authentication providers

To set up Authentication providers using the CLI, run the following command from your project directory:

 firebase init auth 

This command prompts you to select which providers you want to enable and asks for the necessary configuration details for each provider. You can enable Google Sign-In, Email/Password, or Anonymous authentication using the Firebase CLI.

Step 2: Review the firebase.json configuration

After initialization, your firebase.json file will contain an auth section with your provider configurations. You can also manually edit this file to add or update providers.

The following table describes the available fields for Authentication providers that can be set up with the Firebase CLI:

  { 
  
 "auth" 
 : 
  
 { 
  
 "providers" 
 : 
  
 { 
  
 "anonymous" 
 : 
  
 true 
 , 
  
 "emailPassword" 
 : 
  
 true 
 , 
  
 "googleSignIn" 
 : 
  
 { 
  
 "oAuthBrandDisplayName" 
 : 
  
 "My App" 
 , 
  
 "supportEmail" 
 : 
  
 "support@myapp.com" 
 , 
  
 "authorizedRedirectUris" 
 : 
  
 [ 
  
 "https://myapp.com" 
 , 
  
 "http://localhost:4000" 
  
 ] 
  
 } 
  
 } 
  
 } 
 } 
 

Provider configuration fields

The following table describes the available fields for Authentication providers:

Field Description
anonymous Boolean.Set to true to enable Anonymous authentication.
emailPassword Boolean.Set to true to enable Email/Password authentication.
googleSignIn Object.Configuration for Google Sign-In.
googleSignIn.oAuthBrandDisplayName String.The display name for your OAuth brand when using Google Sign-In.
googleSignIn.supportEmail String.The support email registered for your OAuth brand when using Google Sign-In.
googleSignIn.authorizedRedirectUris Array.A list of authorized redirect URIs for Google Sign-In. If you're using Firebase Hosting with the default domain, it will be authorized automatically.

Step 3: Deploy Authentication configuration

To apply your Authentication configuration to your Firebase project, run the following command:

firebase deploy --only auth

This command enables the configured providers and updates their settings in your Firebase project.

Create a Mobile Website
View Site in Mobile | Classic
Share by: