'क्रेडेंशियल सेव' सुविधा की मदद से पासवर्ड सेव करें
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
वापस आने वाले उपयोगकर्ताओं के लिए, एक टैप करके साइन इन करने की सुविधा चालू करने के लिए, उपयोगकर्ताओं से Google खाते में अपना पासवर्ड सेव करने के लिए कहा जा सकता है. उपयोगकर्ता, आपके ऐप्लिकेशन और वेब पर सेव किए गए पासवर्ड से साइन इन कर पाएगा.
पासवर्ड सेव करने की प्रोसेस शुरू करने पर, उपयोगकर्ता को बॉटमशीट डायलॉग दिखेगा. इसमें, उपयोगकर्ता यह चुन पाएगा कि उसे अपना पासवर्ड सेव करना है या नहीं. साथ ही, वह यह भी चुन पाएगा कि उसे किस Google खाते में पासवर्ड सेव करना है.
पासवर्ड सेव करने का बॉटमशीट डायलॉग लॉन्च करें
आपको उपयोगकर्ता नाम और पासवर्ड की पुष्टि करने के बाद, पासवर्ड सेव करने वाला डायलॉग बॉक्स लॉन्च करना चाहिए. पुष्टि करने के दौरान, क्रेडेंशियल को मेमोरी में सेव रखें. क्रेडेंशियल के मान्य होने की पुष्टि करने के बाद, सेव करने का डायलॉग लॉन्च करें. इसके लिए, यह तरीका अपनाएं:
नया SignInPassword ऑब्जेक्ट बनाएं. इसे उस उपयोगकर्ता आईडी से शुरू किया जाना चाहिए जिसका इस्तेमाल उपयोगकर्ता आपकी सेवा के लिए करता है. उदाहरण के लिए, उसका उपयोगकर्ता नाम या ईमेल पता. साथ ही, उस पासवर्ड से शुरू किया जाना चाहिए जिसे आपको सेव करना है.
private static final int REQUEST_CODE_GIS_SAVE_PASSWORD = 2; /* unique request id */
private void savePassword() {
SignInPassword signInPassword = new SignInPassword(userId, password);
...
onActivityResult में, पासवर्ड सेव करने की प्रोसेस के नतीजे को मैनेज करें:
@OverridepublicvoidonActivityResult(intrequestCode,intresultCode,Intentdata){super.onActivityResult(requestCode,resultCode,data);if(requestCode==REQUEST_CODE_GIS_SAVE_PASSWORD){if(resultCode==Activity.RESULT_OK){/* password was saved */}elseif(resultCode==Activity.RESULT_CANCELED){/* password saving was cancelled */}}}
privateActivityResultLauncher<IntentSenderRequest>savePasswordHandler=registerForActivityResult(newActivityResultContracts.StartIntentSenderForResult(),result->{// handle intent result here});
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","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-27 (UTC) को अपडेट किया गया."],[],[],null,["# Save passwords with Credential Saving\n\n| **Caution:** One Tap for Android is deprecated. To ensure the continued security and usability of your app, [migrate to\n| Credential Manager](/identity/sign-in/credential-manager). Credential Manager supports passkey, password, and federated identity authentication (such as Sign-in with Google), stronger security, and a more consistent user experience.\n\nTo enable One Tap sign-in for returning users, you can prompt users to save\ntheir password with Google. The user will be able to sign in with their saved\npasswords in your app and on the web.\n\nWhen you start the save password flow, the user will be presented with a\nbottomsheet dialog allowing them to choose if they want to save their password\nand to which Google Account they want to save it.\n\nLaunch password save bottomsheet dialog\n---------------------------------------\n\nYou should launch the password save dialog after you have authenticated the\nusername and password with your backend. Keep the credentials in memory while\nauthenticating. After you have confirmed the credentials are valid, launch the\nsave dialog by doing the following:\n\n1. Create a new `SignInPassword` object. It should be initialized with the user\n id they use with your service (for example their username or email address)\n and password that you want to save.\n\n private static final int REQUEST_CODE_GIS_SAVE_PASSWORD = 2; /* unique request id */\n private void savePassword() {\n SignInPassword signInPassword = new SignInPassword(userId, password);\n ...\n\n2. Create a `SavePasswordRequest` object\n\n SavePasswordRequest savePasswordRequest =\n SavePasswordRequest.builder().setSignInPassword(signInPassword).build();\n\n3. Get a `PendingIntent` to display the password save dialog from\n `Identity.getCredentialSavingClient` and launch the flow:\n\n Identity.getCredentialSavingClient(activity)\n .savePassword(savePasswordRequest)\n .addOnSuccessListener(\n result -\u003e {\n startIntentSenderForResult(\n result.getPendingIntent().getIntentSender(),\n REQUEST_CODE_GIS_SAVE_PASSWORD,\n /* fillInIntent= */ null,\n /* flagsMask= */ 0,\n /* flagsValue= */ 0,\n /* extraFlags= */ 0,\n /* options= */ null);\n })\n\nHandle password save results\n----------------------------\n\nHandle the result of the password save flow in onActivityResult: \n\n @Override\n public void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n if (requestCode == REQUEST_CODE_GIS_SAVE_PASSWORD) {\n if (resultCode == Activity.RESULT_OK) {\n /* password was saved */\n } else if (resultCode == Activity.RESULT_CANCELED) {\n /* password saving was cancelled */\n }\n }\n }\n\n**Note:** Consider using the [Activity Result API](https://developer.android.com/training/basics/intents/result) to manage Activity callbacks. \n\n private ActivityResultLauncher\u003cIntentSenderRequest\u003e savePasswordHandler =\n registerForActivityResult(new ActivityResultContracts.StartIntentSenderForResult(), result -\u003e {\n // handle intent result here\n });"]]