이 문서에서는 사용자가 로그인할 때 도메인을 볼 수 있도록 Identity Platform 인증 핸들러를 맞춤설정하는 방법을 보여줍니다.
기본 인증 핸들러 이해
프로젝트에 Identity Platform을 사용 설정하면 Firebase 호스팅에서 제공하는 고유한 하위 도메인이 자동으로 생성됩니다.
도메인은 https://[PROJECT-ID].firebaseapp.com 형식을 취합니다.
기본적으로 Identity Platform은 이 도메인을 사용하여 모든 OAuth, OIDC, SAML 로그인 리디렉션을 사용합니다.
기본 도메인을 사용하면 여러 가지 이점이 있습니다.
간편한 설정
동일한 제휴 제공업체를 통해 여러 도메인 사용
여러 서비스와 도메인에서 하나의 콜백 URL 공유
앱당 하나의 콜백 URL만 지원하는 제공업체와 협력
기본 핸들러의 단점은 사용자가 로그인할 때 https://[PROJECT-ID].firebaseapp.com URL이 잠시 표시된다는 점입니다.
인증 핸들러 맞춤설정
기본 핸들러를 재정의하고 자체 핸들러를 제공하려면 다음 안내를 따르세요.
프로젝트를 커스텀 도메인에 연결
Firebase Console을 사용하여 다음 단계를 완료해야 합니다. Google Cloud CLI 또는 Google Cloud 콘솔을 사용할 수 없습니다.
Google Cloud 콘솔에서 ID 공급업체 페이지로 이동하여 SAML 공급업체를 선택합니다.
ID 공급업체 페이지로 이동
승인된 도메인 목록에 커스텀 도메인을 추가합니다.
기본 도메인 대신 커스텀 도메인을 사용하려면 ID 공급업체로 콜백 URL을 업데이트합니다. 예를 들어 https://myproject.firebaseapp.com/__/auth/handler를 https://auth.mycustomdomain.com/__/auth/handler로 변경합니다.
저장을 클릭합니다.
클라이언트 SDK 구성 업데이트
웹
일반적으로Google Cloud 콘솔에서 클라이언트 SDK의 초기화 코드를 복사할 수 있습니다. 인증 핸들러를 맞춤설정하는 경우 authDomain 필드를 커스텀 도메인으로 업데이트해야 합니다.
웹 버전 9
import{initializeApp}from"firebase/app";constfirebaseConfig={apiKey:"...",// By default, authDomain is '[YOUR_APP].firebaseapp.com'.// You may replace it with a custom domain.authDomain:'[YOUR_CUSTOM_DOMAIN]'};constfirebaseApp=initializeApp(firebaseConfig);
firebase.initializeApp({apiKey:'...',// By default, authDomain is '[YOUR_APP].firebaseapp.com'.// You may replace it with a custom domain.authDomain:'[YOUR_CUSTOM_DOMAIN]'});
[[["이해하기 쉬움","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 guide explains how to customize the Identity Platform authentication handler to display your own domain during sign-in instead of the default \u003ccode\u003e[PROJECT-ID].firebaseapp.com\u003c/code\u003e domain.\u003c/p\u003e\n"],["\u003cp\u003eUsing the default domain provides benefits like easier setup and compatibility with providers that only allow one callback URL per app, but it briefly shows the \u003ccode\u003efirebaseapp.com\u003c/code\u003e URL to users.\u003c/p\u003e\n"],["\u003cp\u003eTo customize the handler, you must connect your project to a custom domain, add the custom domain to the list of Authorized Domains, and update the Callback URL with your identity provider to use the new custom domain.\u003c/p\u003e\n"],["\u003cp\u003eAfter customizing the handler, update the \u003ccode\u003eauthDomain\u003c/code\u003e field in your client SDK configuration (Web, Android, iOS) to your custom domain to ensure proper functionality.\u003c/p\u003e\n"],["\u003cp\u003eConfiguring your custom authentication handler is only available through the Firebase Console, and not through Google Cloud CLI or the Google Cloud console.\u003c/p\u003e\n"]]],[],null,["# Showing a custom domain during sign in\n======================================\n\nThis document shows you how to customize the Identity Platform authentication\nhandler so users see your domain when signing in.\n\nUnderstanding the default authentication handler\n------------------------------------------------\n\nWhen you enable Identity Platform for your project, a unique subdomain\npowered by Firebase Hosting is created automatically.\nThe domain takes the form of `https://[PROJECT-ID].firebaseapp.com`.\nBy default, Identity Platform uses this domain to handle all OAuth, OIDC,\nand SAML sign-in redirects.\n\nUsing the default domain has several benefits:\n\n- Easier setup\n\n- Use multiple domains with the same federated providers\n\n- Share a single callback URL across different services and domains\n\n- Works with providers that only support one callback URL per app\n\nThe downside of the default handler is users will briefly see the\n`https://[PROJECT-ID].firebaseapp.com` URL when signing in.\n\nCustomizing the authentication handler\n--------------------------------------\n\nTo override the default handler and provide your own:\n\n1. [Connect your project to a custom domain](https://firebase.google.com/docs/hosting/custom-domain).\n You'll need to complete these steps using the Firebase Console; using\n the Google Cloud CLI or the Google Cloud console is not\n supported.\n\n2. Go to the **Identity Providers** page in the Google Cloud console, and\n select your SAML provider.\n [Go to the Identity Providers page](https://console.cloud.google.com/customer-identity/providers) \n\n3. Add the custom domain to the list of **Authorized Domains**.\n\n4. Update the **Callback URL** with your identity provider to use your custom\n domain instead of the default domain. For example, change\n `https://myproject.firebaseapp.com/__/auth/handler` to\n `https://auth.mycustomdomain.com/__/auth/handler`.\n\n5. Click **Save**.\n\nUpdating your client SDK configuration\n--------------------------------------\n\n### Web\n\nNormally, you can copy the initialization code for the client SDK from the\nGoogle Cloud console. If you customize the authentication handler, you'll\nneed to update the `authDomain` field to your custom domain: \n\n### Web version 9\n\n```javascript\nimport { initializeApp } from \"firebase/app\";\n\nconst firebaseConfig = {\n apiKey: \"...\",\n // By default, authDomain is '[YOUR_APP].firebaseapp.com'.\n // You may replace it with a custom domain.\n authDomain: '[YOUR_CUSTOM_DOMAIN]'\n};\nconst firebaseApp = initializeApp(firebaseConfig);https://github.com/firebase/snippets-web/blob/467eaa165dcbd9b3ab15711e76fa52237ba37f8b/snippets/auth-next/index/auth_init_custom_domain.js#L8-L16\n```\n\n### Web version 8\n\n```javascript\nfirebase.initializeApp({\n apiKey: '...',\n // By default, authDomain is '[YOUR_APP].firebaseapp.com'.\n // You may replace it with a custom domain.\n authDomain: '[YOUR_CUSTOM_DOMAIN]'\n});https://github.com/firebase/snippets-web/blob/467eaa165dcbd9b3ab15711e76fa52237ba37f8b/auth/index.js#L107-L112\n```\n\n### Android and iOS\n\nTo customize the authentication handler, use the following code: \n\n### Java\n\n FirebaseAuth.getInstance().setCustomAuthDomain(\"[YOUR_CUSTOM_DOMAIN]\");\n\n### Kotlin+KTX\n\n Firebase.auth.setCustomAuthDomain(\"[YOUR_CUSTOM_DOMAIN]\")\n\n### Swift\n\n let auth = Auth.auth()\n auth.customAuthDomain = \"[YOUR_CUSTOM_DOMAIN]\"\n\n### Objective-C\n\n FIRAuth *auth = [FIRAuth auth];\n auth.customAuthDomain(\"[YOUR_CUSTOM_DOMAIN]\");"]]