Stay organized with collections Save and categorize content based on your preferences.
Region IDThe REGION_ID
is an abbreviated code that Google assigns based on the region you select when you create your app. The code does not correspond to a country or province, even though some region IDs may appear similar to commonly used country and province codes. For apps created after February 2020, REGION_ID.r
is included in App Engine URLs. For existing apps created before this date, the region ID is optional in the URL.
Learn more about region IDs.
Note: If you are deploying a new Python web service to Google Cloud, we recommend getting started with Cloud Run.Add Firebase to your Google Cloud project, configure your authentication settings, and then add Firebase to your web service.
Adding Firebase to your web service enables you to authenticate users so that you can give each user a personalized experience.
Before you beginIf you have completed all the previous steps in this guide, skip this section. Otherwise, complete one of the following:
Start from Build a Python 3 App and complete all the steps leading up to this one.
If you already have a Google Cloud project, you can continue by downloading a copy of the web service:
Download the sample application repository using Git:
git clone https://github.com/GoogleCloudPlatform/python-docs-samples
Alternatively, you can download the sample as a zip file and then extract it.
Navigate to the directory that contains a copy of the files from the previous step:
cd python-docs-samples/appengine/standard_python3/building-an-app/building-an-app-1
To use Firebase authentication with your web service, add Firebase to your Google Cloud project and configure your authentication settings.
Add Firebase to your existing Google Cloud project using the Add project tool in the Firebase console.
You can also choose to use a Firebase account with a different name, not associated with your existing Google Cloud project.
Enable the authentication sign-on providers in the Firebase console. For this web service, you will enable Email/Password and Google sign-in providers:
Click Build > Authentication > Sign-in method.
Under Sign-in providers, select Email/Password.
Toggle the Enable button to use email and password authentication, and click Save.
Tip: For more information about enabling other providers, see the "Before you begin" sections of the Google, Facebook, Twitter, and GitHub guides on Firebase.For Firebase to authenticate properly, your domain needs to be authorized for OAuth redirects. To authorize your domain:
Select Build > Authentication > Settings.
Under Authorized domains on the Settings page, click Add Domain.
Enter the domain of your app on App Engine, excluding the http://
prefix:
PROJECT_ID
. REGION_ID.r.appspot.com
where PROJECT_ID
is the ID of your Google Cloud project.
To add Firebase to your web service, copy your Firebase project's custom code snippet, JavaScript and CSS files into your web service:
Go to the Firebase console and select your project.
From the project overview page, under the text Get started by adding Firebase to your app, select web. If you already have an app added to the project, you may not see this text; instead, navigate to the Project Overview > Project settings > General page of your existing app, scroll down, and select Add app.
Once the app is registered, a customized code snippet will be displayed. Copy the contents of the snippet. To see this code snippet again later, navigate to the Project settings page for your Firebase app.
Update your templates/index.html
file by completing the following:
Add the following lines to the <head>
tag:
Add your customized code snippet to the <body>
tag.
For this tutorial, you can add the code to the top of the body, since the only content in templates/index.html
is an example of Firebase services. In your production environment, we recommend that you add the code snippet to the bottom of the body, but before you use any Firebase services.
Your custom code will look similar to this mock snippet:
<!-- MOCK SNIPPET: DO NOT COPY -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/7.14.5/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script>
var config = {
apiKey: "<API_KEY>",
authDomain: "<PROJECT_ID>.firebaseapp.com",
databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
projectId: "<PROJECT_ID>",
storageBucket: "<BUCKET>.appspot.com",
messagingSenderId: "<SENDER_ID>",
};
firebase.initializeApp(config);
</script>
Replace the TODO in the snippet above with the following script tag to enable the Authentication component of Firebase:
<script src="https://www.gstatic.com/firebasejs/7.8.0/firebase-auth.js"></script>
These script addresses are documented in the Firebase UI for Web documentation.
Replace the rest of the body with the following code, which you will use later in this guide to display authenticated user data:
Now that you've added Firebase to your Google Cloud project and your web service, you're ready to add code to your web service to enable it to authenticate users.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["The `REGION_ID` is a Google-assigned code based on the region selected during app creation, which is included in App Engine URLs for apps created after February 2020."],["Firebase can be added to a Google Cloud project to enable user authentication for a personalized web service experience."],["Adding Firebase to your Google Cloud project involves using the Firebase console to add your project, enabling authentication sign-on providers like Email/Password and Google, and authorizing your domain for OAuth redirects."],["Adding Firebase to a web service involves copying a customized code snippet, JavaScript, and CSS files from the Firebase console into the service's `index.html` file, ensuring the Firebase Authentication component is properly included."],["To continue, you have to add code to your web service that will enable user authentication."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4