SMS Retriever API를 사용한 자동 SMS 인증
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
SMS Retriever API를 사용하면 사용자가 직접 인증 코드를 입력하지 않아도 되며, 추가 앱 권한이 없어도 Android 앱에서 SMS 기반 사용자 인증을 자동으로 실행할 수 있습니다. 앱에서 자동 SMS 인증을 구현하면 인증 흐름은 다음과 같습니다.

- 사용자가 앱에서 SMS 인증을 시작합니다. 앱에서 사용자에게 전화번호를 입력하라는 메시지를 표시하거나 사용자의 계정을 만드는 데 필요한 정보가 아닌 경우 비밀번호 대용 Smart Lock 힌트 선택기를 사용할 수 있습니다.
- 앱에서 서버에 사용자의 전화번호를 인증하도록 요청합니다.
사용자 데이터베이스에서 사용할 수 있는 정보에 따라 이 요청에는 사용자 ID, 사용자 전화번호 또는 둘 다 포함될 수 있습니다.
- 동시에 앱은 SMS Retriever API를 호출하여 서버에서 SMS 응답을 리슨합니다.
- 서버는 사용자에게 서버로 전송할 일회용 코드와 앱을 식별하는 해시가 포함된 SMS 메시지를 보냅니다.
- 사용자의 기기에서 SMS 메시지를 수신하면 Google Play 서비스는 앱 해시를 사용하여 메시지가 앱을 대상으로 하는 것인지 확인하고 SMS Retriever API를 통해 메시지 텍스트를 앱에 제공합니다.
- 앱은 메시지 텍스트에서 일회용 코드를 파싱하여 서버로 다시 전송합니다.
- 서버는 앱에서 일회성 코드를 수신하고 코드를 확인한 후 마지막으로 사용자가 계정을 성공적으로 인증했음을 기록합니다.
앱에서 자동 SMS 인증을 구현하려면 Android 및 서버 가이드를 참조하세요.
Android 가이드
서버 가이드
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-25(UTC)
[null,null,["최종 업데이트: 2025-07-25(UTC)"],[[["\u003cp\u003eThe SMS Retriever API enables automatic SMS verification in Android apps, eliminating manual code entry for users.\u003c/p\u003e\n"],["\u003cp\u003eThis API streamlines user verification by having your app listen for an SMS message containing a one-time code, sent by your server after a verification request.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Play services identifies the incoming SMS message as intended for your app using an app hash included in the message, ensuring secure delivery of the verification code.\u003c/p\u003e\n"],["\u003cp\u003eThe SMS Retriever API enhances user experience and security by automating verification without requiring extra app permissions.\u003c/p\u003e\n"]]],[],null,["# Automatic SMS Verification with the SMS Retriever API\n\nWith the SMS Retriever API, you can perform SMS-based user verification in your\nAndroid app automatically, without requiring the user to manually type\nverification codes, and without requiring any extra app permissions. When you\nimplement automatic SMS verification in your app, the verification flow looks\nlike this:\n\n[](/static/identity/sms-retriever/flow-overview.png)\n\n1. A user initiates SMS verification in your app. Your app might prompt the user to provide a phone number or use the [Smart Lock for Passwords hint selector](/identity/smartlock-passwords/android/retrieve-hints) if that information wasn't required to create the user's account.\n2. Your app makes a request to your server to verify the user's phone number. Depending on what information is available in your user database, this request might include the user's ID, the user's phone number, or both.\n3. At the same time, your app calls the SMS Retriever API to begin listening for an SMS response from your server.\n4. Your server sends an SMS message to the user that includes a one-time code to be sent back to your server, and a hash that identifies your app.\n5. When the user's device receives the SMS message, Google Play services uses the app hash to determine that the message is intended for your app, and makes the message text available to your app through the SMS Retriever API.\n6. Your app parses out the one-time code from the message text and sends it back to your server.\n7. Your server receives the one-time code from your app, verifies the code, and finally records that the user has successfully verified their account.\n\nTo implement automatic SMS verification in your app, see the Android and server\nguides:\n\n[Android Guide](/identity/sms-retriever/request)\n[Server Guide](/identity/sms-retriever/verify)"]]