FirebaseUI는 로그인 흐름만 처리하므로 사용자가 로그인할 테넌트를 선택할 수 있는 고유한 UI를 빌드해야 합니다. 다음 단계에서는 버튼 두 개를 사용하여 간단한 테넌트 선택 페이지를 빌드하는 방법을 보여줍니다.
두 개의 테넌트 선택 요소를 만듭니다.
<div id="tenant-selection-buttons">
<button id="tenant1-select-button" data-val="tenantId1">Display name of Tenant 1</button>
<button id="tenant2-select-button" data-val="tenantId2">Display name of Tenant 2</button>
</div>
이 예시에서는 두 개의 단순한 버튼과 단일 페이지를 사용하지만 다양한 UX 흐름을 사용할 수 있습니다. 예를 들어 사용자에게 한 페이지에 이메일을 입력하고 테넌트 선택 화면을 표시하도록 요청할 수 있습니다. 각 테넌트마다 별도의 로그인 페이지를 호스팅할 수도 있습니다. 이 경우 URL에서 테넌트 ID를 파싱한 다음 Auth 객체에서 설정해야 합니다.
[[["이해하기 쉬움","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\u003eThis document provides a guide on creating a tenant-specific sign-in page for Identity Platform using FirebaseUI and the Client SDK.\u003c/p\u003e\n"],["\u003cp\u003eYou must first enable multi-tenancy and configure identity providers for each tenant before implementing the sign-in page.\u003c/p\u003e\n"],["\u003cp\u003eFirebaseUI is used for sign-in flows, but the UI for tenant selection, such as buttons, must be custom-built.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves creating tenant selection elements, a FirebaseUI container, tenant-specific configurations, and click handlers to render the appropriate sign-in component.\u003c/p\u003e\n"],["\u003cp\u003eMultiple UX flows are possible, such as separate login pages for each tenant, where the tenant ID can be parsed from the URL.\u003c/p\u003e\n"]]],[],null,["# Creating a sign-in page for multiple tenants\n============================================\n\nThis document shows you how to build a tenant-specific sign-in page for\nIdentity Platform using\n[FirebaseUI](https://github.com/firebase/firebaseui-web), a\ncollection of open-source, pre-built UI components, and the\n[Client SDK](https://github.com/firebase/firebase-js-sdk).\n\nSample code demonstrating the steps covered in this tutorial is available\non [GitHub](https://github.com/firebase/quickstart-js/blob/master/auth/multi-tenant-ui.html).\n\nBefore you begin\n----------------\n\n1. [Enable multi-tenancy and create at least two tenants](/identity-platform/docs/multi-tenancy-quickstart).\n2. [Configure identity providers for each tenant](/identity-platform/docs/quickstart-cicp#add-provider).\n\nGetting the components\n----------------------\n\nYou can fetch the UI script, Client SDK, and CSS files directly\nfrom the CDN by adding them to the `\u003chead\u003e` element of your page: \n\n \u003cscript src=\"https://www.gstatic.com/firebasejs/x.x.x/firebase-app.js\"\u003e\u003c/script\u003e\n \u003cscript src=\"https://www.gstatic.com/firebasejs/x.x.x/firebase-auth.js\"\u003e\u003c/script\u003e\n \u003cscript src=\"https://cdn.firebase.com/libs/firebaseui/x.x.x/firebaseui.js\"\u003e\u003c/script\u003e\n \u003clink rel=\"stylesheet\" href=\"https://cdn.firebase.com/libs/firebaseui/x.x.x/firebaseui.css\" /\u003e\n\nAlternatively, you can install the modules using `npm`, and then reference them\nas ES6 imports: \n\n npm install firebase --save && \\\n npm install firebaseui --save\n\n // Import Firebase JS SDK.\n import * as firebase from \"firebase/app\";\n import \"firebase/auth\";\n import * as firebaseui from 'firebaseui'\n\n### Building a tenant selection UI\n\nFirebaseUI only handles sign-in flows; you'll need to build your own UI\nfor users to select a tenant to sign in with. The following steps show you how\nto build a simple tenant selection page with two buttons.\n\n1. Create two tenant selection elements.\n\n \u003cdiv id=\"tenant-selection-buttons\"\u003e\n \u003cbutton id=\"tenant1-select-button\" data-val=\"tenantId1\"\u003eDisplay name of Tenant 1\u003c/button\u003e\n \u003cbutton id=\"tenant2-select-button\" data-val=\"tenantId2\"\u003eDisplay name of Tenant 2\u003c/button\u003e\n \u003c/div\u003e\n\n2. Create a container element for FirebaseUI.\n\n \u003cdiv id=\"firebaseui-auth-container\"\u003e\u003c/div\u003e\n\n3. Create a configuration for each tenant.\n\n \u003cscript\u003e\n var uiConfigs = {\n 'TENANT_ID1': {\n 'signInOptions': [firebase.auth.EmailAuthProvider.PROVIDER_ID],\n 'credentialHelper': 'none',\n 'signInFlow': 'popup',\n 'callbacks': {\n 'signInSuccessWithAuthResult': function(authResult, redirectUrl) {\n // The sign in success callback.\n return false;\n }\n },\n // tosUrl and privacyPolicyUrl accept either url string or a callback\n // function.\n // Terms of service url/callback.\n tosUrl: '[YOUR_TOS_URL]',\n // Privacy policy url/callback.\n privacyPolicyUrl: function() {\n window.location.assign('[YOUR_PRIVACY_POLICY_URL]');\n }\n },\n 'TENANT_ID2': {\n 'signInOptions': [firebase.auth.GoogleAuthProvider.PROVIDER_ID],\n 'credentialHelper': 'none',\n 'signInFlow': 'popup',\n 'callbacks': {\n 'signInSuccessWithAuthResult': function(authResult, redirectUrl) {\n // The sign in success callback.\n return false;\n }\n },\n // tosUrl and privacyPolicyUrl accept either url string or a callback\n // function.\n // Terms of service url/callback.\n tosUrl: '[YOUR_TOS_URL]',\n // Privacy policy url/callback.\n privacyPolicyUrl: function() {\n window.location.assign('[YOUR_PRIVACY_POLICY_URL]');\n }\n }\n };\n \u003c/script\u003e\n\n4. Add tenant selection click handlers to render the sign-in component\n with FirebaseUI. Note that before rendering the UI component, you'll need to\n set the tenant ID on the `Auth` instance.\n\n \u003cscript\u003e\n var ui = new firebaseui.auth.AuthUI(firebase.auth());\n tenantSelectionButton.addEventListener('click', (e) =\u003e {\n var tenantId = e.target.getAttribute('data-val');\n firebase.auth().tenantId = tenantId;\n ui.reset();\n ui.start('#firebaseui-auth-container', uiConfigs[tenantId]);\n });\n \u003c/script\u003e\n\n5. Launch your app. A sign-in screen with two tenant buttons appears.\n\nWhile this example uses two simple buttons and a single page, many different\nUX flows are possible. For example, you could ask users to enter their email on\none page, then present a tenant selection screen. You could also host separate\nlogin pages for each tenant; in this case, you'd need to parse the tenant ID\nfrom the URL, and then set it on the `Auth` object.\n\nWhat's next\n-----------\n\n- [See the FirebaseUI source code on GitHub](https://github.com/firebase/firebaseui-web)"]]