אימות אוטומטי באמצעות SMS באמצעות ממשק ה-API של SMS Retriever
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
ב-SMS Fetcher API, ניתן לבצע אימות משתמש מבוסס-SMS באפליקציה ל-Android באופן אוטומטי, ללא צורך בהקלדה ידנית של קודי אימות, ללא צורך בהרשאת אפליקציות נוספות. כשמטמיעים באפליקציה אימות אוטומטי של הודעות SMS, תהליך האימות נראה כך:
משתמש מתחיל את תהליך אימות ה-SMS באפליקציה שלך. ייתכן שהאפליקציה תבקש מהמשתמש לספק מספר טלפון או להשתמש בבורר הרמז לסיסמאות חכמות, אם המידע הזה לא נדרש כדי ליצור את חשבון המשתמש.
האפליקציה שלך שולחת לשרת שלך בקשה לאימות מספר הטלפון של המשתמש.
בהתאם למידע שזמין במסד הנתונים של המשתמש, הבקשה עשויה לכלול את מזהה המשתמש, את מספר הטלפון של המשתמש או את שניהם.
במקביל, האפליקציה קוראת ל-SMS Fetchr API כדי להתחיל להאזין לתגובת SMS מהשרת שלכם.
השרת שלכם שולח למשתמש הודעת SMS שכוללת קוד חד-פעמי שנשלח חזרה לשרת, וגיבוב שמזהה את האפליקציה שלכם.
כאשר המכשיר של המשתמש מקבל את הודעת ה-SMS, שירותי Google Play משתמשים בגיבוב האפליקציה כדי לקבוע שההודעה מיועדת לאפליקציה והופכים את טקסט ההודעה זמין לאפליקציה דרך ממשק ה-API של SMS Fetch.
האפליקציה מנתחת את הקוד החד-פעמי מטקסט ההודעה ושולחת אותו שוב לשרת שלכם.
השרת שלכם מקבל את הקוד החד-פעמי מהאפליקציה, מאמת את הקוד ולבסוף מתעד שהמשתמש הצליח לאמת את החשבון שלו.
כדי ליישם אימות אוטומטי של SMS באפליקציה שלכם, עיינו במדריכים ל-Android ולשרת:
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 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,["With 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)"]]