REGION_ID는 앱을 만들 때 선택한 리전을 기준으로 Google에서 할당하는 축약된 코드입니다. 일부 리전 ID는 일반적으로 사용되는 국가 및 주/도 코드와 비슷하게 표시될 수 있지만 코드는 국가 또는 주/도와 일치하지 않습니다. 2020년 2월 이후에 생성된 앱의 경우 REGION_ID.r이 App Engine URL에 포함됩니다. 이 날짜 이전에 만든 기존 앱의 경우 URL에서 리전 ID는 선택사항입니다.
프로젝트 개요 페이지의 앱에 Firebase를 추가하여 시작하기 텍스트 아래에서 웹을 선택합니다. 프로젝트에 이미 앱이 추가된 경우 이 텍스트가 표시되지 않을 수 있습니다. 대신 기존 앱의 프로젝트 개요 > 프로젝트 설정 > 일반 페이지로 이동하여 아래로 스크롤하고 앱 추가를 선택합니다.
앱이 등록되면 맞춤설정된 코드 스니펫이 표시됩니다. 스니펫의 콘텐츠를 복사합니다. 나중에 이 코드 스니펫을 보려면 Firebase 앱의 프로젝트 설정 페이지로 이동하세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eThe \u003ccode\u003eREGION_ID\u003c/code\u003e 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.\u003c/p\u003e\n"],["\u003cp\u003eFirebase can be added to a Google Cloud project to enable user authentication for a personalized web service experience.\u003c/p\u003e\n"],["\u003cp\u003eAdding 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.\u003c/p\u003e\n"],["\u003cp\u003eAdding Firebase to a web service involves copying a customized code snippet, JavaScript, and CSS files from the Firebase console into the service's \u003ccode\u003eindex.html\u003c/code\u003e file, ensuring the Firebase Authentication component is properly included.\u003c/p\u003e\n"],["\u003cp\u003eTo continue, you have to add code to your web service that will enable user authentication.\u003c/p\u003e\n"]]],[],null,["# Add Firebase to your web service\n\n### Region ID\n\nThe \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e is an abbreviated code that Google assigns\nbased on the region you select when you create your app. The code does not\ncorrespond to a country or province, even though some region IDs may appear\nsimilar to commonly used country and province codes. For apps created after\nFebruary 2020, \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e`.r` is included in\nApp Engine URLs. For existing apps created before this date, the\nregion ID is optional in the URL.\n\nLearn more\n[about region IDs](/appengine/docs/standard/python3/how-requests-are-routed#region-id). \nOK\n\n\u003cbr /\u003e\n\n| **Note:** If you are deploying a new Python web service to Google Cloud, we recommend getting started with [Cloud Run](/run/docs/quickstarts/build-and-deploy/deploy-python-service).\n\nAdd Firebase to your Google Cloud project, configure your authentication\nsettings, and then add Firebase to your web service.\n\nAdding Firebase to your web service enables you to authenticate users\nso that you can give each user a personalized experience.\n\nBefore you begin\n----------------\n\nIf you have completed all the previous steps in this guide, skip this section.\nOtherwise, complete one of the following:\n\n- Start from [Build a Python 3 App](/appengine/docs/standard/python3/building-app)\n and complete all the steps leading up to this one.\n\n- If you already have a\n [Google Cloud project](/appengine/docs/standard/python3/building-app/creating-gcp-project),\n you can continue by downloading a copy of the web service:\n\n 1. Download the sample application repository using\n [Git](https://git-scm.com/):\n\n git clone https://github.com/GoogleCloudPlatform/python-docs-samples\n\n Alternatively, you can [download the sample](https://github.com/GoogleCloudPlatform/python-docs-samples/archive/master.zip) as a zip\n file and then extract it.\n 2. Navigate to the directory that contains a copy of the files from the\n previous step:\n\n cd python-docs-samples/appengine/standard_python3/building-an-app/building-an-app-1\n\nAdd Firebase to your Google Cloud project\n-----------------------------------------\n\nTo use Firebase authentication with your web service, add\nFirebase to your Google Cloud project and configure your authentication\nsettings.\n\n1. Add Firebase to your existing Google Cloud project using the\n **Add project** tool in the [Firebase console](https://console.firebase.google.com/).\n\n You can also choose to use a Firebase account with a different name, not\n associated with your existing Google Cloud project.\n2. Enable the authentication sign-on providers in the\n [Firebase console](https://console.firebase.google.com/). For this\n web service, you will enable **Email/Password** and **Google** sign-in\n providers:\n\n 1. Click **Build** \\\u003e **Authentication** \\\u003e **Sign-in method**.\n\n 2. Under **Sign-in providers** , select **Email/Password**.\n\n 3. Toggle the **Enable** button to use email and password authentication,\n and click **Save**.\n\n | **Tip:** For more information about enabling other providers, see the \"Before you begin\" sections of the [Google](https://firebase.google.com/docs/auth/web/google-signin), [Facebook](https://firebase.google.com/docs/auth/web/facebook-login), [Twitter](https://firebase.google.com/docs/auth/web/twitter-login), and [GitHub](https://firebase.google.com/docs/auth/web/github-auth) guides on Firebase.\n3. For Firebase to authenticate properly, your domain needs to be authorized\n for OAuth redirects. To authorize your domain:\n\n 1. Select **Build** \\\u003e **Authentication** \\\u003e **Settings**.\n\n 2. Under **Authorized domains** on the **Settings** page, click **Add Domain**.\n\n 3. Enter the domain of your app on App Engine, excluding the\n `http://` prefix:\n\n \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e.\n \u003cvar translate=\"no\"\u003e\u003ca href=\"#appengine-urls\" style=\"border-bottom: 1px dotted #999\" class=\"devsite-dialog-button\" data-modal-dialog-id=\"regional_url\" track-type=\"progressiveHelp\" track-name=\"modalHelp\" track-metadata-goal=\"regionalURL\"\u003eREGION_ID\u003c/a\u003e\u003c/var\u003e`.r.appspot.com`\n where \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e is the ID of your\n Google Cloud project.\n\nAdd Firebase to your web service\n--------------------------------\n\nTo add Firebase to your web service, copy your Firebase project's custom code\nsnippet, JavaScript and CSS files into your web service:\n\n1. Go to the [Firebase console](https://console.firebase.google.com/) and select your project.\n\n2. From the project overview page, under the text **Get started by adding\n Firebase to your app** , select **web** . If you already have an app added to\n the project, you may not see this text; instead, navigate to the\n **Project Overview** \\\u003e **Project settings** \\\u003e **General**\n page of your existing app, scroll down, and select **Add app**.\n\n3. Once the app is registered, a customized code snippet will be displayed. Copy\n the contents of the snippet. To see this code snippet again later, navigate\n to the **Project settings** page for your Firebase app.\n\n4. Update your `templates/index.html` file by completing the following:\n\n 1. Add the following lines to the `\u003chead\u003e` tag:\n\n \u003cscript src=\"https://www.gstatic.com/firebasejs/ui/6.0.1/firebase-ui-auth.js\"\u003e\u003c/script\u003e\n \u003clink type=\"text/css\" rel=\"stylesheet\" href=\"https://www.gstatic.com/firebasejs/ui/6.0.1/firebase-ui-auth.css\" /\u003e\n\n 2. Add your customized code snippet to the `\u003cbody\u003e` tag.\n\n For this tutorial, you can add the code to the top of the body, since the\n only content in `templates/index.html` is an example of Firebase\n services. In your production environment, we recommend that you add the\n code snippet to the bottom of the body, but before you use any Firebase\n services.\n\n Your custom code will look similar to this mock snippet: \n\n \u003c!-- MOCK SNIPPET: DO NOT COPY --\u003e\n \u003c!-- The core Firebase JS SDK is always required and must be listed first --\u003e\n \u003cscript src=\"https://www.gstatic.com/firebasejs/7.14.5/firebase-app.js\"\u003e\u003c/script\u003e\n\n \u003c!-- TODO: Add SDKs for Firebase products that you want to use\n https://firebase.google.com/docs/web/setup#available-libraries --\u003e\n\n \u003cscript\u003e\n var config = {\n apiKey: \"\u003cAPI_KEY\u003e\",\n authDomain: \"\u003cPROJECT_ID\u003e.firebaseapp.com\",\n databaseURL: \"https://\u003cDATABASE_NAME\u003e.firebaseio.com\",\n projectId: \"\u003cPROJECT_ID\u003e\",\n storageBucket: \"\u003cBUCKET\u003e.appspot.com\",\n messagingSenderId: \"\u003cSENDER_ID\u003e\",\n };\n firebase.initializeApp(config);\n \u003c/script\u003e\n\n 3. Replace the TODO in the snippet above with the following script tag to\n enable the Authentication component of Firebase:\n\n \u003cbr /\u003e\n\n ```\n \u003cscript src=\"https://www.gstatic.com/firebasejs/7.8.0/firebase-auth.js\"\u003e\u003c/script\u003e\n \n ```\n\n \u003cbr /\u003e\n\n These script addresses are documented in the [Firebase UI for Web\n documentation](https://firebaseopensource.com/projects/firebase/firebaseui-web/).\n 4. Replace the rest of the body with the following code, which you will use\n later in this guide to display authenticated user data:\n\n \u003cdiv id=\"firebaseui-auth-container\"\u003e\u003c/div\u003e\n\n \u003cbutton id=\"sign-out\" hidden=true\u003eSign Out\u003c/button\u003e\n\n \u003cdiv id=\"login-info\" hidden=true\u003e\n \u003ch2\u003eLogin info:\u003c/h2\u003e\n {% if user_data %}\n \u003cdl\u003e\n \u003cdt\u003eName\u003c/dt\u003e\u003cdd\u003e{{ user_data['name'] }}\u003c/dd\u003e\n \u003cdt\u003eEmail\u003c/dt\u003e\u003cdd\u003e{{ user_data['email'] }}\u003c/dd\u003e\n \u003cdt\u003eLast 10 visits\u003c/dt\u003e\u003cdd\u003e\n \t{% for time in times %}\n \u003cp\u003e{{ time['timestamp'] }}\u003c/p\u003e\n {% endfor %} \u003c/dd\u003e\n \u003c/dl\u003e\n {% elif error_message %}\n \u003cp\u003eError: {{ error_message }}\u003c/p\u003e\n {% endif %}\n \u003c/div\u003e\n\nNext Steps\n----------\n\nNow that you've added Firebase to your Google Cloud project and your web\nservice, you're ready to add code to your web service to enable it to\nauthenticate users."]]