পাসওয়ার্ডের জন্য স্মার্ট লক , যেটি 2022 সালে বাতিল করা হয়েছিল, এখন Google Play Services Auth SDK ( com.google.android.gms:play-services-auth
) থেকে সরানো হয়েছে৷ বিদ্যমান ইন্টিগ্রেশনগুলিকে প্রভাবিত করতে পারে এমন ব্রেকিং পরিবর্তনগুলি কমাতে, প্লে স্টোরের সমস্ত বিদ্যমান অ্যাপগুলির জন্য স্মার্ট লক ক্ষমতাগুলি সঠিকভাবে কাজ করতে থাকবে৷ আপডেট করা SDK ( com.google.android.gms:play-services-auth:21.0.0
) এর সাথে সংকলিত নতুন অ্যাপ সংস্করণগুলি আর পাসওয়ার্ড API-এর জন্য Smart Lock অ্যাক্সেস করতে সক্ষম নয় এবং সফলভাবে তৈরি হবে না। যত তাড়াতাড়ি সম্ভব ক্রেডেনশিয়াল ম্যানেজার ব্যবহার করার জন্য সমস্ত বিকাশকারীদের তাদের Android প্রকল্পগুলি স্থানান্তর করা উচিত৷
ক্রেডেনশিয়াল ম্যানেজার API-এ মাইগ্রেশনের সুবিধা
ক্রেডেনশিয়াল ম্যানেজার একটি সহজ, ইউনিফাইড API অফার করে যা আপনার ব্যবহারকারীদের জন্য প্রমাণীকরণ অভিজ্ঞতা উন্নত করার সময় আধুনিক বৈশিষ্ট্য এবং অনুশীলনের জন্য সমর্থন সক্ষম করে:
- ক্রেডেনশিয়াল ম্যানেজার সম্পূর্ণরূপে পাসওয়ার্ড সংরক্ষণ এবং প্রমাণীকরণ সমর্থন করে ৷ এর মানে হল আপনার ব্যবহারকারীদের জন্য কোনো বাধা নেই কারণ আপনার অ্যাপ Smart Lock থেকে ক্রেডেনশিয়াল ম্যানেজারে স্থানান্তরিত হয়।
- ক্রেডেনশিয়াল ম্যানেজার একাধিক সাইন ইন পদ্ধতির জন্য সমর্থন সংহত করে, যার মধ্যে রয়েছে পাসকি এবং Google এর সাথে সাইন ইন করার মত ফেডারেটেড সাইন ইন পদ্ধতি, নিরাপত্তা বাড়াতে এবং আপনি যদি ভবিষ্যতে সমর্থন করার পরিকল্পনা করেন তবে রূপান্তর সক্ষম করতে৷
- অ্যান্ড্রয়েড 14 দিয়ে শুরু করে, ক্রেডেনশিয়াল ম্যানেজার তৃতীয় পক্ষের পাসওয়ার্ড এবং পাসকি প্রদানকারীদের সমর্থন করে।
- ক্রেডেনশিয়াল ম্যানেজার সমস্ত প্রমাণীকরণ পদ্ধতি জুড়ে একটি সামঞ্জস্যপূর্ণ, একীভূত ব্যবহারকারীর অভিজ্ঞতা প্রদান করে।
মাইগ্রেশন বিকল্প :
কেস ব্যবহার করুন | সুপারিশ |
---|---|
পাসওয়ার্ড সংরক্ষণ করুন এবং সংরক্ষিত পাসওয়ার্ড দিয়ে সাইন ইন করুন | ক্রেডেনশিয়াল ম্যানেজার গাইড সহ আপনার ব্যবহারকারী সাইন ইন করুন থেকে পাসওয়ার্ড বিকল্পটি ব্যবহার করুন। পাসওয়ার্ড সংরক্ষণ এবং প্রমাণীকরণের বিস্তারিত পদক্ষেপগুলি পরে বর্ণিত হয়েছে। |
Google দিয়ে সাইন ইন করুন | গুগল গাইডের সাথে সাইন ইন করে ইন্টিগ্রেট ক্রেডেনশিয়াল ম্যানেজার অনুসরণ করুন। |
ব্যবহারকারীদের ফোন নম্বর ইঙ্গিত দেখান | গুগল আইডেন্টিটি সার্ভিসেস থেকে ফোন নম্বর হিন্ট API ব্যবহার করুন। |
ক্রেডেনশিয়াল ম্যানেজার ব্যবহার করে পাসওয়ার্ড দিয়ে সাইন ইন করুন
ক্রেডেনশিয়াল ম্যানেজার এপিআই ব্যবহার করতে, ক্রেডেনশিয়াল ম্যানেজার গাইডের পূর্বশর্ত বিভাগে বর্ণিত পদক্ষেপগুলি সম্পূর্ণ করুন এবং নিশ্চিত করুন যে আপনি নিম্নলিখিতগুলি করেছেন:
- প্রয়োজনীয় নির্ভরতা যোগ করুন
- ProGuard ফাইলে ক্লাস সংরক্ষণ করুন
- ডিজিটাল সম্পদ লিঙ্কগুলির জন্য সমর্থন যোগ করুন (আপনি যদি পাসওয়ার্ডের জন্য স্মার্ট লক ব্যবহার করেন তবে এই পদক্ষেপটি ইতিমধ্যেই প্রয়োগ করা উচিত)
- শংসাপত্র ম্যানেজার কনফিগার করুন
- শংসাপত্র ক্ষেত্র নির্দেশ করুন
- একটি ব্যবহারকারীর পাসওয়ার্ড সংরক্ষণ করুন
সংরক্ষিত পাসওয়ার্ড দিয়ে সাইন ইন করুন
ব্যবহারকারীর অ্যাকাউন্টের সাথে যুক্ত পাসওয়ার্ড বিকল্পগুলি পুনরুদ্ধার করতে, এই পদক্ষেপগুলি সম্পূর্ণ করুন:
1. পাসওয়ার্ড এবং প্রমাণীকরণ বিকল্পটি শুরু করুন
// Retrieves the user's saved password for your app from their
// password provider.
val getPasswordOption = GetPasswordOption()
2. সাইন-ইন অনুরোধ তৈরি করতে পূর্ববর্তী ধাপ থেকে প্রাপ্ত বিকল্পগুলি ব্যবহার করুন৷
val getCredRequest = GetCredentialRequest(
listOf(getPasswordOption)
)
3. সাইন-ইন প্রবাহ চালু করুন৷
fun launchSignInFlow() {
coroutineScope.launch {
try {
// Attempt to retrieve the credential from the Credential Manager.
val result = credentialManager.getCredential(
// Use an activity-based context to avoid undefined system UI
// launching behavior.
context = activityContext,
request = getCredRequest
)
// Process the successfully retrieved credential.
handleSignIn(result)
} catch (e: GetCredentialException) {
// Handle any errors that occur during the credential retrieval
// process.
handleFailure(e)
}
}
}
private fun handleSignIn(result: GetCredentialResponse) {
// Extract the credential from the response.
val credential = result.credential
// Determine the type of credential and handle it accordingly.
when (credential) {
is PasswordCredential -> {
val username = credential.id
val password = credential.password
// Use the extracted username and password to perform
// authentication.
}
else -> {
// Handle unrecognized credential types.
Log.e(TAG, "Unexpected type of credential")
}
}
}
private fun handleFailure(e: GetCredentialException) {
// Handle specific credential retrieval errors.
when (e) {
is GetCredentialCancellationException -> {
/* This exception is thrown when the user intentionally cancels
the credential retrieval operation. Update the application's state
accordingly. */
}
is GetCredentialCustomException -> {
/* This exception is thrown when a custom error occurs during the
credential retrieval flow. Refer to the documentation of the
third-party SDK used to create the GetCredentialRequest for
handling this exception. */
}
is GetCredentialInterruptedException -> {
/* This exception is thrown when an interruption occurs during the
credential retrieval flow. Determine whether to retry the
operation or proceed with an alternative authentication method. */
}
is GetCredentialProviderConfigurationException -> {
/* This exception is thrown when there is a mismatch in
configurations for the credential provider. Verify that the
provider dependency is included in the manifest and that the
required system services are enabled. */
}
is GetCredentialUnknownException -> {
/* This exception is thrown when the credential retrieval
operation fails without providing any additional details. Handle
the error appropriately based on the application's context. */
}
is GetCredentialUnsupportedException -> {
/* This exception is thrown when the device does not support the
Credential Manager feature. Inform the user that credential-based
authentication is unavailable and guide them to an alternative
authentication method. */
}
is NoCredentialException -> {
/* This exception is thrown when there are no viable credentials
available for the user. Prompt the user to sign up for an account
or provide an alternative authentication method. Upon successful
authentication, store the login information using
androidx.credentials.CredentialManager.createCredential to
facilitate easier sign-in the next time. */
}
else -> {
// Handle unexpected exceptions.
Log.w(TAG, "Unexpected exception type: ${e::class.java.name}")
}
}
}
অতিরিক্ত সম্পদ
- শংসাপত্র ম্যানেজার নমুনা রেফারেন্স
- ক্রেডেনশিয়াল ম্যানেজার কোডল্যাব
- ক্রেডেনশিয়াল ম্যানেজার দিয়ে আপনার ব্যবহারকারীকে সাইন ইন করুন