전화 인증을 테스트하는 경우 공급업체 목록에서 인증 기관을 찾은 후 수정 아이콘을 클릭합니다. 다단계 인증을 테스트하는 경우 다단계 SMS 탭을 선택한 다음 수정을 클릭합니다.
테스트용 전화번호에 등록할 전화번호와 인증 코드를 입력합니다.
전화번호는 E.164 형식을 사용해야 하며 이미 기존 Identity Platform 사용자에게 할당할 수 없습니다. 인증 코드는 6자리 숫자여야 합니다.
보안상의 이유로 추측하기 어려운 숫자를 선택하고 +1 123-456-7890와 같이 모호한 패턴을 사용하지 마세요.
저장을 클릭합니다.
테스트 전화번호는 Identity Platform에서 실제 전화번호처럼 취급되므로 안전하게 저장하고 정기적으로 순환해야 합니다.
수동 테스트
앱에서 직접 또는 iOS 및 Android 에뮬레이터를 사용하여 테스트 전화번호를 즉시 사용할 수 있습니다. 테스트 전화번호로 로그인하면 SMS 인증 코드가 전송되지 않습니다. 대신 테스트 번호를 만들 때 등록한 코드를 입력합니다.
로그인하면 테스트 전화번호를 사용하여 Identity Platform 사용자가 생성됩니다. 이 사용자는 유효한 ID 토큰을 포함하여 실제 사용자와 동일한 동작과 속성을 가지고 있으므로 모든 앱과 서비스에 액세스할 수 있습니다.
테스트 사용자의 액세스를 제한하려면 제한된 권한으로 테스트 역할을 만들고 커스텀 클레임을 사용하여 할당하는 것이 좋습니다.
통합 테스트
클라이언트 SDK에는 수동 테스트 외에도 통합 테스트를 작성하는 데 도움이 되는 API가 포함되어 있습니다. 이러한 API는 reCAPTCHA 및 앱 인증 요구사항을 사용 중지하므로 자동화를 통해 쉽게 우회할 수 있습니다.
다음 예시는 전화번호로 사용자 로그인 처리를 테스트하는 방법을 보여줍니다.
자바스크립트
// Turn off phone app verification.firebase.auth().settings.appVerificationDisabledForTesting=true;varphoneNumber="+16505554567";vartestVerificationCode="123456";// Render a fake reCAPTCHA and resolve without app verification.varappVerifier=newfirebase.auth.RecaptchaVerifier('recaptcha-container');// signInWithPhoneNumber will call appVerifier.verify(), which will resolve// with a fake reCAPTCHA response.firebase.auth().signInWithPhoneNumber(phoneNumber,appVerifier).then(function(confirmationResult){// confirmationResult can resolve using testVerificationCode.returnconfirmationResult.confirm(testVerificationCode)}).catch(function(error){// Error; SMS not sent// ...});
앱 인증을 사용 중지하면 보이거나 보이지 않는 모의 reCAPTCHA 인증기가 다르게 작동합니다.
보이는 reCAPTCHA: 사용자 클릭을 시뮬레이션하기 위해 reCAPTCHA는 잠시 후에 자동으로 자체 확인됩니다.
보이지 않는 reCAPTCHA: 앱 인증을 시뮬레이션하기 위해 appVerifier.verify()가 호출되면 reCAPTCHA가 자동으로 확인됩니다.
[[["이해하기 쉬움","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 details how to register up to 10 test phone numbers with Identity Platform for development and testing, allowing you to simulate phone-based authentication methods.\u003c/p\u003e\n"],["\u003cp\u003eUsing test numbers eliminates the need for real SMS messages, prevents throttling, bypasses security checks, and doesn't affect your usage quota.\u003c/p\u003e\n"],["\u003cp\u003eTo register, navigate to the Identity Providers page in the Google Cloud console, input a phone number in E.164 format and a six-digit verification code under "Phone numbers for testing," ensuring the number isn't already in use by an existing Identity Platform user.\u003c/p\u003e\n"],["\u003cp\u003eTest phone numbers function like real numbers within Identity Platform, allowing you to use them directly or with iOS/Android emulators and requiring the registered verification code for sign-in.\u003c/p\u003e\n"],["\u003cp\u003eClient SDK APIs are available to simplify integration testing by disabling reCAPTCHA and app verification, demonstrated with a JavaScript example that also showcases mock reCAPTCHA behavior.\u003c/p\u003e\n"]]],[],null,["# Registering test phone numbers\n==============================\n\nThis document shows you how to register phone numbers with Identity Platform\nfor development purposes. This allows you to test authentication methods that\ninvolve sending an SMS message, such as phone sign-in and multi-factor\nauthentication.\n\nUsing a test number (rather than a real number you own) has several benefits:\n\n- It integrates seamlessly with the iOS and Android emulators.\n- It eliminates the overhead of sending an actual SMS.\n- You can execute consecutive tests with the same phone number without being throttled.\n- You can write integration tests without being blocked by security checks.\n- It doesn't consume your usage quota.\n\nYou can register up to 10 phone numbers for development.\n\nRegistering a test phone number\n-------------------------------\n\nTo register a test phone number:\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) \n\n2. If you are testing phone authentication, locate it in the list of providers,\n then click the **Edit** icon. If you are testing multi-factor\n authentication, select the **Multi-factor SMS** tab, then click **Edit**.\n\n3. Under **Phone numbers for testing**, enter a phone number and verification\n code to register.\n\n The phone number should use\n [E.164 format](https://wikipedia.org/wiki/E.164), and cannot already be assigned to an existing\n Identity Platform user. The verification code should be six digits.\n For security purposes, choose numbers that are difficult to guess, and avoid\n obvious patterns like `+1 123-456-7890`.\n4. Click **Save**.\n\nTesting phone numbers are treated like real phone numbers by\nIdentity Platform, so store them securely and rotate them at regular\nintervals.\n\nManual testing\n--------------\n\nYou can immediately begin using test phone numbers in your app, either directly\nor using the iOS and Android emulators. When signing in with a test phone\nnumber, no SMS verification code is sent; instead, enter the code you registered\nwhen creating the test number.\n\nAfter signing in, an Identity Platform user is created using the test phone\nnumber. This user has the same behavior and properties as a real user,\nincluding a valid ID token, meaning it can access all your apps and services.\n\nTo restrict access from your test users, consider creating a test role with\nlimited permissions and assigning it using\n[custom claims](/identity-platform/docs/how-to-configure-custom-claims).\n\nIntegration testing\n-------------------\n\nIn addition to manual testing, the client SDK contains APIs that can help\nwrite integration tests. These APIs disable the reCAPTCHA and app verification\nrequirements, making them easier bypass with automation.\n\nThe following example shows how to test signing in a user with a phone number: \n\n### JavaScript\n\n // Turn off phone app verification.\n firebase.auth().settings.appVerificationDisabledForTesting = true;\n\n var phoneNumber = \"+16505554567\";\n var testVerificationCode = \"123456\";\n\n // Render a fake reCAPTCHA and resolve without app verification.\n var appVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container');\n // signInWithPhoneNumber will call appVerifier.verify(), which will resolve\n // with a fake reCAPTCHA response.\n firebase.auth().signInWithPhoneNumber(phoneNumber, appVerifier)\n .then(function (confirmationResult) {\n // confirmationResult can resolve using testVerificationCode.\n return confirmationResult.confirm(testVerificationCode)\n }).catch(function (error) {\n // Error; SMS not sent\n // ...\n });\n\nVisible and invisible mock reCAPTCHA verifiers behave differently when\napp verification is disabled:\n\n- **Visible reCAPTCHA:** To simulate a user click, the reCAPTCHA will resolve\n itself automatically after a brief delay.\n\n- **Invisible reCAPTCHA** : To simulate app verification, the reCAPTCHA will\n resolve automatically when `appVerifier.verify()` is called.\n\nMock reCAPTCHAs will still trigger their callbacks when they resolve or expire.\n\nWhat's next\n-----------\n\n- Add multi-factor authentication to your [web](/identity-platform/docs/web/mfa), [iOS](/identity-platform/docs/ios/mfa), or [Android](/identity-platform/docs/android/mfa) app."]]