ইউনিটিতে একটি অ্যাকাউন্টে একাধিক প্রমাণ প্রদানকারীকে লিঙ্ক করুন
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
আপনি একটি বিদ্যমান ব্যবহারকারীর অ্যাকাউন্টে প্রমাণীকরণ প্রদানকারীর শংসাপত্র লিঙ্ক করে একাধিক প্রমাণীকরণ প্রদানকারী ব্যবহার করে ব্যবহারকারীদের আপনার অ্যাপে সাইন ইন করার অনুমতি দিতে পারেন। ব্যবহারকারীরা সাইন ইন করতে যে প্রমাণীকরণ প্রদানকারীই ব্যবহার করুক না কেন একই Firebase ব্যবহারকারী আইডি দ্বারা শনাক্ত করা যায়৷ উদাহরণস্বরূপ, যে ব্যবহারকারী একটি পাসওয়ার্ড দিয়ে সাইন ইন করেছেন সে একটি Google অ্যাকাউন্ট লিঙ্ক করতে পারে এবং ভবিষ্যতে যেকোনো পদ্ধতিতে সাইন ইন করতে পারে৷ অথবা, একজন বেনামী ব্যবহারকারী একটি Facebook অ্যাকাউন্ট লিঙ্ক করতে পারেন এবং তারপরে, আপনার অ্যাপ ব্যবহার চালিয়ে যেতে Facebook-এ সাইন ইন করতে পারেন।
আপনি শুরু করার আগে
আপনার অ্যাপে দুই বা ততোধিক প্রমাণীকরণ প্রদানকারীর জন্য সমর্থন যোগ করুন (সম্ভবত বেনামী প্রমাণীকরণ সহ)।
একটি ব্যবহারকারীর অ্যাকাউন্টে অনুমোদন প্রদানকারীর শংসাপত্র লিঙ্ক করুন
একটি বিদ্যমান ব্যবহারকারী অ্যাকাউন্টে প্রমাণীকরণ প্রদানকারীর শংসাপত্রগুলি লিঙ্ক করতে:
যেকোনো প্রমাণীকরণ প্রদানকারী বা পদ্ধতি ব্যবহার করে ব্যবহারকারীকে সাইন ইন করুন।
Firebase.Auth.FirebaseAuth.SignInAndRetrieveDataWithCredentialAsync পদ্ধতিগুলির একটিতে কল করা পর্যন্ত নতুন প্রমাণীকরণ প্রদানকারীর জন্য সাইন-ইন প্রবাহ সম্পূর্ণ করুন, কিন্তু অন্তর্ভুক্ত নয়৷ উদাহরণস্বরূপ, ব্যবহারকারীর গুগল আইডি টোকেন, ফেসবুক অ্যাক্সেস টোকেন বা ইমেল এবং পাসওয়ার্ড পান।
নতুন প্রমাণীকরণ প্রদানকারীর জন্য একটি Firebase.Auth.Credential পান:
Firebase.Auth.Credential অবজেক্টটি সাইন-ইন করা ব্যবহারকারীর LinkWithCredentialAsync পদ্ধতিতে পাস করুন:
auth.CurrentUser.LinkWithCredentialAsync(credential).ContinueWith(task=>{if(task.IsCanceled){Debug.LogError("LinkWithCredentialAsync was canceled.");return;}if(task.IsFaulted){Debug.LogError("LinkWithCredentialAsync encountered an error: "+task.Exception);return;}Firebase.Auth.AuthResultresult=task.Result;Debug.LogFormat("Credentials successfully linked to Firebase user: {0} ({1})",result.User.DisplayName,result.User.UserId);});
LinkWithCredentialAsync এ কল ব্যর্থ হবে যদি শংসাপত্রগুলি ইতিমধ্যেই অন্য ব্যবহারকারীর অ্যাকাউন্টের সাথে লিঙ্ক করা থাকে। এই পরিস্থিতিতে, আপনাকে অবশ্যই আপনার অ্যাপের জন্য উপযুক্ত হিসাবে অ্যাকাউন্ট এবং সংশ্লিষ্ট ডেটা মার্জিং পরিচালনা করতে হবে:
// Gather data for the currently signed in User.stringcurrentUserId=auth.CurrentUser.UserId;stringcurrentEmail=auth.CurrentUser.Email;stringcurrentDisplayName=auth.CurrentUser.DisplayName;System.UricurrentPhotoUrl=auth.CurrentUser.PhotoUrl;// Sign in with the new credentials.auth.SignInAndRetrieveDataWithCredentialAsync(credential).ContinueWith(task=>{if(task.IsCanceled){Debug.LogError("SignInAndRetrieveDataWithCredentialAsync was canceled.");return;}if(task.IsFaulted){Debug.LogError("SignInAndRetrieveDataWithCredentialAsync encountered an error: "+task.Exception);return;}Firebase.Auth.AuthResultresult=task.Result;Debug.LogFormat("User signed in successfully: {0} ({1})",result.User.DisplayName,result.User.UserId);// TODO: Merge app specific details using the newUser and values from the// previous user, saved above.});
LinkWithCredentialAsync এ কল সফল হলে, ব্যবহারকারী এখন যেকোনো লিঙ্ক করা প্রমাণীকরণ প্রদানকারী ব্যবহার করে সাইন ইন করতে পারবেন এবং একই Firebase ডেটা অ্যাক্সেস করতে পারবেন।
একটি ব্যবহারকারীর অ্যাকাউন্ট থেকে একটি প্রমাণ প্রদানকারীকে লিঙ্কমুক্ত করুন৷
আপনি একটি অ্যাকাউন্ট থেকে একটি প্রমাণ প্রদানকারীকে লিঙ্কমুক্ত করতে পারেন, যাতে ব্যবহারকারী আর সেই প্রদানকারীর সাথে সাইন ইন করতে না পারে৷
একটি ব্যবহারকারীর অ্যাকাউন্ট থেকে একটি প্রমাণ প্রদানকারীকে আনলিঙ্ক করতে, প্রদানকারী আইডিটিকে UnlinkAsync পদ্ধতিতে পাস করুন৷ আপনি ProviderData কল করে একজন ব্যবহারকারীর সাথে লিঙ্ক করা প্রমাণ প্রদানকারীর প্রদানকারী আইডি পেতে পারেন।
// Unlink the sign-in provider from the currently active user.// providerIdString is a string identifying a provider,// retrieved via FirebaseAuth.FetchProvidersForEmail().auth.CurrentUser.UnlinkAsync(providerIdString).ContinueWith(task=>{if(task.IsCanceled){Debug.LogError("UnlinkAsync was canceled.");return;}if(task.IsFaulted){Debug.LogError("UnlinkAsync encountered an error: "+task.Exception);return;}// The user has been unlinked from the provider.Firebase.Auth.AuthResultresult=task.Result;Debug.LogFormat("Credentials successfully unlinked from user: {0} ({1})",result.User.DisplayName,result.User.UserId);});
[[["সহজে বোঝা যায়","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-09-03 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["| **Important** : There is a [known issue](https://github.com/firebase/firebase-js-sdk/issues/7675) that prevents `linkWithCredentials()` from working correctly in some projects. See the issue report for a workaround and the status of a fix.\n\nYou can allow users to sign in to your app using multiple authentication\nproviders by linking auth provider credentials to an existing user account.\nUsers are identifiable by the same Firebase user ID regardless of the\nauthentication provider they used to sign in. For example, a user who signed in\nwith a password can link a Google account and sign in with either method in the\nfuture. Or, an anonymous user can link a Facebook account and then, later, sign\nin with Facebook to continue using your app.\n\nBefore you begin\n\nAdd support for two or more authentication providers (possibly including\nanonymous authentication) to your app.\nThe `FirebaseAuth` class is the gateway for all API calls. It is accessible through [FirebaseAuth.DefaultInstance](/docs/reference/unity/class/firebase/auth/firebase-auth#defaultinstance). \n\n```c#\nFirebase.Auth.FirebaseAuth auth = Firebase.Auth.FirebaseAuth.DefaultInstance;\n```\n\nLink auth provider credentials to a user account\n\nTo link auth provider credentials to an existing user account:\n\n1. Sign in the user using any authentication provider or method.\n2. Complete the sign-in flow for the new authentication provider up to, but not including, calling one of the [`Firebase.Auth.FirebaseAuth.SignInAndRetrieveDataWithCredentialAsync`](/docs/reference/unity/class/firebase/auth/firebase-auth#signinandretrievedatawithcredentialasync) methods. For example, get the user's Google ID token, Facebook access token, or email and password.\n3. Get a `Firebase.Auth.Credential` for the new authentication provider:\n\n **Google Sign-In** \n\n ```c#\n Firebase.Auth.Credential credential =\n Firebase.Auth.GoogleAuthProvider.GetCredential(googleIdToken, googleAccessToken);\n ```\n **Facebook Login** \n\n ```c#\n Firebase.Auth.Credential credential =\n Firebase.Auth.FacebookAuthProvider.GetCredential(accessToken);\n ```\n **Email-password sign-in** \n\n ```c#\n Firebase.Auth.Credential credential =\n Firebase.Auth.EmailAuthProvider.GetCredential(email, password);\n ```\n4. Pass the `Firebase.Auth.Credential` object to the signed-in user's\n `LinkWithCredentialAsync` method:\n\n ```c#\n auth.CurrentUser.LinkWithCredentialAsync(credential).ContinueWith(task =\u003e {\n if (task.IsCanceled) {\n Debug.LogError(\"LinkWithCredentialAsync was canceled.\");\n return;\n }\n if (task.IsFaulted) {\n Debug.LogError(\"LinkWithCredentialAsync encountered an error: \" + task.Exception);\n return;\n }\n\n Firebase.Auth.AuthResult result = task.Result;\n Debug.LogFormat(\"Credentials successfully linked to Firebase user: {0} ({1})\",\n result.User.DisplayName, result.User.UserId);\n });\n ```\n\n The call to `LinkWithCredentialAsync` will fail if the credentials are\n already linked to another user account. In this situation, you must handle\n merging the accounts and associated data as appropriate for your app: \n\n ```c#\n // Gather data for the currently signed in User.\n string currentUserId = auth.CurrentUser.UserId;\n string currentEmail = auth.CurrentUser.Email;\n string currentDisplayName = auth.CurrentUser.DisplayName;\n System.Uri currentPhotoUrl = auth.CurrentUser.PhotoUrl;\n\n // Sign in with the new credentials.\n auth.SignInAndRetrieveDataWithCredentialAsync(credential).ContinueWith(task =\u003e {\n if (task.IsCanceled) {\n Debug.LogError(\"SignInAndRetrieveDataWithCredentialAsync was canceled.\");\n return;\n }\n if (task.IsFaulted) {\n Debug.LogError(\"SignInAndRetrieveDataWithCredentialAsync encountered an error: \" + task.Exception);\n return;\n }\n\n Firebase.Auth.AuthResult result = task.Result;\n Debug.LogFormat(\"User signed in successfully: {0} ({1})\",\n result.User.DisplayName, result.User.UserId);\n\n // TODO: Merge app specific details using the newUser and values from the\n // previous user, saved above.\n });\n ```\n\nIf the call to `LinkWithCredentialAsync` succeeds, the user can now sign in using\nany linked authentication provider and access the same Firebase data.\n\nUnlink an auth provider from a user account\n\nYou can unlink an auth provider from an account, so that the user can no\nlonger sign in with that provider.\n\nTo unlink an auth provider from a user account, pass the provider ID to the\n`UnlinkAsync` method. You can get the provider IDs of the auth\nproviders linked to a user by calling\n[`ProviderData`](/docs/reference/unity/class/firebase/auth/firebase-user#providerdata). \n\n```c#\n// Unlink the sign-in provider from the currently active user.\n// providerIdString is a string identifying a provider,\n// retrieved via FirebaseAuth.FetchProvidersForEmail().\nauth.CurrentUser.UnlinkAsync(providerIdString).ContinueWith(task =\u003e {\n if (task.IsCanceled) {\n Debug.LogError(\"UnlinkAsync was canceled.\");\n return;\n }\n if (task.IsFaulted) {\n Debug.LogError(\"UnlinkAsync encountered an error: \" + task.Exception);\n return;\n }\n\n // The user has been unlinked from the provider.\n Firebase.Auth.AuthResult result = task.Result;\n Debug.LogFormat(\"Credentials successfully unlinked from user: {0} ({1})\",\n result.User.DisplayName, result.User.UserId);\n});\n```\n\nTroubleshooting\n\nIf you encounter errors when trying to link multiple accounts, see the\n[documentation on\nverified email addresses](https://firebase.google.com/docs/auth/users#verified_email_addresses)."]]