Apple은 사용자에게 이메일 주소 등의 데이터를 익명처리할 수 있는 옵션을 제공합니다. Apple은 이 옵션을 선택한 사용자에게 privaterelay.appleid.com 도메인이 있는 난독화된 이메일 주소를 할당합니다.
앱은 익명처리된 Apple ID와 관련된 모든 관련 개발자 정책 또는 Apple의 약관을 준수해야 합니다. 여기에는 개인 식별 정보(PII)를 익명 처리된 Apple ID와 연결하기 전에 사용자 동의를 얻는 과정이 포함됩니다. PII와 관련된 작업에는 다음이 포함되지만 이에 국한되지는 않습니다.
익명처리된 Apple ID에 이메일 주소를 연결하거나 그 반대로 연결합니다.
익명처리된 Apple ID에 전화번호 연결하거나 그 반대로 연결합니다.
익명처리된 Apple ID에 익명처리되지 않은 소셜 사용자 인증 정보(Facebook, Google 등)를 연결하거나 그 반대로 연결합니다.
자세한 내용은 Apple 개발자 계정의 Apple 개발자 프로그램 라이선스 계약을 참조하세요.
선택사항: OAuth 범위를 추가합니다. 범위는 Apple에서 요청할 데이터를 지정합니다. 더 민감한 정보에는 특정 범위가 필요할 수 있습니다. 기본적으로 이메일 주소당 계정 1개가 사용 설정되어 있으면 Identity Platform은 email 및 name 범위를 요청합니다.
선택사항: 인증 흐름을 현지화합니다. 언어를 지정하거나 기기의 기본 언어를 사용할 수 있습니다.
자바
// Localize the Apple authentication screen in French.provider.addCustomParameter("locale","fr");
Kotlin
// Localize the Apple authentication screen in French.provider.addCustomParameter("locale","fr");
Identity Platform으로 사용자를 로그인 처리합니다.
startActivityForSignInWithProvider()을 호출하여 응답이 이미 있는지 확인합니다.
자바
mAuth=FirebaseAuth.getInstance();Task<AuthResult>pending=mAuth.getPendingAuthResult();if(pending!=null){pending.addOnSuccessListener(newOnSuccessListener<AuthResult>(){@OverridepublicvoidonSuccess(AuthResultauthResult){Log.d(TAG,"checkPending:onSuccess:"+authResult);// Get the user profile with authResult.getUser() and// authResult.getAdditionalUserInfo(), and the ID// token from Apple with authResult.getCredential().}}).addOnFailureListener(newOnFailureListener(){@OverridepublicvoidonFailure(@NonNullExceptione){Log.w(TAG,"checkPending:onFailure",e);}});}else{Log.d(TAG,"pending: null");}
Kotlin
valpending=auth.pendingAuthResultif(pending!=null){pending.addOnSuccessListener{authResult->
Log.d(TAG,"checkPending:onSuccess:$authResult")// Get the user profile with authResult.getUser() and// authResult.getAdditionalUserInfo(), and the ID// token from Apple with authResult.getCredential().}.addOnFailureListener{e->
Log.w(TAG,"checkPending:onFailure",e)}}else{Log.d(TAG,"pending: null")}
로그인하면 활동이 백그라운드에서 진행되므로 인증 과정에서 시스템이 활동을 회수할 수 있습니다. 결과가 이미 있는지 확인하면 사용자가 두 번 로그인할 필요가 없습니다.
대기 중인 결과가 없으면 startActivityForSignInWithProvider()을 호출합니다.
사용자가 앱에 실제 이메일을 공유하지 않는 경우 Apple에서는 사용자가 대신 공유할 고유 이메일 주소를 프로비저닝합니다. 이 이메일은 xyz@privaterelay.appleid.com 형식을 사용합니다. 비공개 이메일 릴레이 서비스를 구성한 경우 Apple은 익명처리된 이메일 주소로 전송된 이메일을 사용자의 실제 이메일 주소로 전달합니다.
Apple은 사용자가 처음 로그인할 때만 표시 이름과 같은 사용자 정보를 앱과 공유합니다. 대부분의 경우 Identity Platform은 이 데이터를 저장하므로 향후 세션 중에 firebase.auth().currentUser.displayName을 사용해 데이터를 가져올 수 있습니다. 하지만 Identity Platform과 통합하기 전에 사용자가 Apple을 사용하여 앱에 로그인할 수 있도록 허용한 경우에는 사용자 정보를 사용할 수 없습니다.
[[["이해하기 쉬움","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 outlines how to integrate "Sign in with Apple" functionality into your Android application using Identity Platform.\u003c/p\u003e\n"],["\u003cp\u003eYou must configure your app on the Apple Developer site, including registering a Return URL, temporarily hosting a verification file, and obtaining your Services ID, Apple team ID, key ID, and private key.\u003c/p\u003e\n"],["\u003cp\u003eTo configure Apple as an identity provider, you'll need to add Apple as a provider in the Google Cloud console and input the necessary credentials, such as your Services ID, Apple team ID, key ID, and private key.\u003c/p\u003e\n"],["\u003cp\u003eWhen implementing sign-in, you can customize the authentication flow by adding specific OAuth scopes to request user data, and also can localize the authentication screen.\u003c/p\u003e\n"],["\u003cp\u003eIf a user chooses to anonymize their data, Apple will use a unique email address in the format \u003ccode\u003exyz@privaterelay.appleid.com\u003c/code\u003e, which you must comply with by not associating PII with the anonymized Apple ID without user consent.\u003c/p\u003e\n"]]],[],null,["# Signing in users with Apple on Android\n======================================\n\nThis document shows you how to use Identity Platform to add *Sign in with Apple*\nto your Android app.\n\nBefore you begin\n----------------\n\n- Create an Android app that uses Identity Platform.\n\n- Join the [Apple Developer Program](https://developer.apple.com/programs).\n\nConfiguring your app with Apple\n-------------------------------\n\nOn the Apple Developer site:\n\n1. Follow the steps in [Configure Sign in with Apple for the web](https://developer.apple.com/help/account/configure-app-capabilities/configure-sign-in-with-apple-for-the-web).\n This includes:\n\n 1. Registering a *Return URL*, which looks like:\n\n ```\n https://project-id.firebaseapp.com/__/auth/handler\n ```\n 2. Temporarily hosting a file at the following URL to verify your domain:\n\n ```\n https://project-id.firebaseapp.com/.well-known/apple-developer-domain-association.txt\n ```\n\n Additionally, take note of your *Services ID* and *Apple team ID* --- you'll\n need them in the next section.\n2. [Use an Apple private key to create a sign in](https://developer.apple.com/help/account/configure-app-capabilities/create-a-sign-in-with-apple-private-key).\n You'll need the *key* and its *ID* in the next section.\n\n3. If you use Identity Platform to send emails to your users,\n [configure your project with Apple's private email relay service](https://developer.apple.com/help/account/configure-app-capabilities/configure-private-email-relay-service)\n using the following email:\n\n ```\n noreply@project-id.firebaseapp.com\n ```\n\n You can also use a custom email template, if your app has one.\n\nComplying with Apple's anonymized data requirements\n---------------------------------------------------\n\nApple gives users the option of anonymizing their data, including\ntheir email address. Apple assigns users who select this option an obfuscated\nemail address with the domain `privaterelay.appleid.com`.\n\nYour app must comply with any applicable developer policies or terms from Apple\nregarding anonymized Apple IDs. This includes obtaining user consent before\nassociating any personally identifying information (PII) with an anonymized\nApple ID. Actions that involve PII include, but are not limited to:\n\n- Linking an email address to an anonymized Apple ID, or vice versa.\n- Linking a phone number to an anonymized Apple ID, or vice versa\n- Linking a non-anonymous social credential, such as Facebook or Google, to to anonymized Apple ID, or vice versa.\n\nFor more information, refer to the *Apple Developer Program License Agreement*\nfor your Apple developer account.\n\nConfiguring Apple as a provider\n-------------------------------\n\nTo configure Apple as an identity provider:\n\n1. Go to the **Identity Providers** page in the Google Cloud console.\n\n [Go to the Identity Providers page](https://console.cloud.google.com/customer-identity/providers)\n2. Click **Add a Provider**.\n\n3. Select **Apple** from the list.\n\n4. Under **Platform** , select **Android**.\n\n5. Enter your **Services ID** , **Apple team ID** , **Key ID** , and\n **Private key**.\n\n6. Register your app's domains by clicking **Add domain** under\n **Authorized domains** . For development purposes, `localhost` is already\n enabled by default.\n\n | **Important:** In projects created after April 28, 2025, Identity Platform no longer includes `localhost` as an authorized domain by default. Google strongly discourages the use of `localhost` in production projects. If you choose to authorize `localhost`, you can manually add it in the **Settings** page, in **Authorized Domains** , by clicking **Add Domain**.\n7. Under **Configure your application** , click **Android**. Copy the\n snippet into your app's code to initialize the Identity Platform\n client SDK.\n\n8. Click **Save**.\n\nSigning in users with the client SDK\n------------------------------------\n\n1. Create an instance of the `OAuthProvider` provider object, using the\n ID `apple.com`:\n\n ### Java\n\n OAuthProvider.Builder provider = OAuthProvider.newBuilder(\"apple.com\");\n\n ### Kotlin\n\n val provider = OAuthProvider.newBuilder(\"apple.com\")\n\n2. **Optional:** Add OAuth scopes. Scopes specify what data you are\n requesting from Apple. More sensitive data may require specific\n scopes. By default, when **One account per email address** is enabled,\n Identity Platform requests the `email` and `name` scopes.\n\n ### Java\n\n List\u003cString\u003e scopes =\n new ArrayList\u003cString\u003e() {\n {\n add(\"email\");\n add(\"name\");\n }\n };\n provider.setScopes(scopes);\n\n ### Kotlin\n\n provider.setScopes(arrayOf(\"email\", \"name\"))\n\n3. **Optional:** Localize the authentication flow. You can specify a language,\n or use the device's default language:\n\n ### Java\n\n // Localize the Apple authentication screen in French.\n provider.addCustomParameter(\"locale\", \"fr\");\n\n ### Kotlin\n\n // Localize the Apple authentication screen in French.\n provider.addCustomParameter(\"locale\", \"fr\");\n\n4. Sign in the user with Identity Platform.\n\n | **Note:** When a user signs in, Identity Platform takes control of your UI and opens a [Custom Chrome Tab](https://developer.chrome.com/multidevice/android/customtabs). Because of this, you shouldn't reference your Activity in the `OnSuccessListener` and `OnFailureListener` listeners; they will immediately detach when the authentication operation starts.\n 1. Check if a response is already present by calling\n `startActivityForSignInWithProvider()`:\n\n ### Java\n\n mAuth = FirebaseAuth.getInstance();\n Task\u003cAuthResult\u003e pending = mAuth.getPendingAuthResult();\n if (pending != null) {\n pending.addOnSuccessListener(new OnSuccessListener\u003cAuthResult\u003e() {\n @Override\n public void onSuccess(AuthResult authResult) {\n Log.d(TAG, \"checkPending:onSuccess:\" + authResult);\n // Get the user profile with authResult.getUser() and\n // authResult.getAdditionalUserInfo(), and the ID\n // token from Apple with authResult.getCredential().\n }\n }).addOnFailureListener(new OnFailureListener() {\n @Override\n public void onFailure(@NonNull Exception e) {\n Log.w(TAG, \"checkPending:onFailure\", e);\n }\n });\n } else {\n Log.d(TAG, \"pending: null\");\n }\n\n ### Kotlin\n\n val pending = auth.pendingAuthResult\n if (pending != null) {\n pending.addOnSuccessListener { authResult -\u003e\n Log.d(TAG, \"checkPending:onSuccess:$authResult\")\n // Get the user profile with authResult.getUser() and\n // authResult.getAdditionalUserInfo(), and the ID\n // token from Apple with authResult.getCredential().\n }.addOnFailureListener { e -\u003e\n Log.w(TAG, \"checkPending:onFailure\", e)\n }\n } else {\n Log.d(TAG, \"pending: null\")\n }\n\n Signing in puts your Activity in the background, which means the system\n can reclaim it during the authentication flow. Checking if a result is\n already present prevents the user from having to sign in twice.\n 2. If there's no pending result, call\n `startActivityForSignInWithProvider()`:\n\n ### Java\n\n mAuth.startActivityForSignInWithProvider(this, provider.build())\n .addOnSuccessListener(\n new OnSuccessListener\u003cAuthResult\u003e() {\n @Override\n public void onSuccess(AuthResult authResult) {\n // Sign-in successful!\n Log.d(TAG, \"activitySignIn:onSuccess:\" + authResult.getUser());\n FirebaseUser user = authResult.getUser();\n // ...\n }\n })\n .addOnFailureListener(\n new OnFailureListener() {\n @Override\n public void onFailure(@NonNull Exception e) {\n Log.w(TAG, \"activitySignIn:onFailure\", e);\n }\n });\n\n ### Kotlin\n\n auth.startActivityForSignInWithProvider(this, provider.build())\n .addOnSuccessListener { authResult -\u003e\n // Sign-in successful!\n Log.d(TAG, \"activitySignIn:onSuccess:${authResult.user}\")\n val user = authResult.user\n // ...\n }\n .addOnFailureListener { e -\u003e\n Log.w(TAG, \"activitySignIn:onFailure\", e)\n }\n\nUnlike many other identity providers, Apple does not provide a photo URL.\n\nIf a user chooses not to share their real email with your app, Apple provisions\na unique email address for that user to share instead. This email takes the form\n`xyz@privaterelay.appleid.com`. If you configured the private email relay\nservice, Apple forwards emails sent to the anonymized address to the user's real\nemail address.\n\nApple only shares user information, such as display names, with apps the\nfirst time a user signs in. In most cases, Identity Platform stores this\ndata, which lets you fetch it using `firebase.auth().currentUser.displayName`\nduring future sessions. However, if you allowed users to sign into your app\nusing Apple before integrating with Identity Platform, user information\nis not available.\n\nWhat's next\n-----------\n\n- Learn more about [Identity Platform users](/identity-platform/docs/concepts-manage-users).\n- Sign in users with [other identity providers](/identity-platform/docs/how-to#signing-in-users)."]]