সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
ফায়ারবেস প্রমাণীকরণ SDKগুলি প্রমাণীকরণ পদ্ধতি ব্যবহার করে ঘটতে পারে এমন বিভিন্ন ত্রুটি ধরার জন্য একটি সহজ উপায় প্রদান করে। Flutter-এর জন্য SDK গুলি FirebaseAuthException ক্লাসের মাধ্যমে এই ত্রুটিগুলি প্রকাশ করে৷
সর্বনিম্ন, একটি code এবং message প্রদান করা হয়, তবে কিছু ক্ষেত্রে অতিরিক্ত বৈশিষ্ট্য যেমন একটি ইমেল ঠিকানা এবং শংসাপত্রও প্রদান করা হয়। উদাহরণস্বরূপ, যদি ব্যবহারকারী একটি ইমেল এবং পাসওয়ার্ড দিয়ে সাইন ইন করার চেষ্টা করেন, তাহলে যেকোন ত্রুটি ছোঁড়া হলে তা স্পষ্টভাবে ধরা যেতে পারে:
try{awaitFirebaseAuth.instance.signInWithEmailAndPassword(email:"barry.allen@example.com",password:"SuperSecretPassword!");}onFirebaseAuthExceptioncatch(e){print('Failed with error code: ${e.code}');print(e.message);}
প্রতিটি পদ্ধতি প্রমাণীকরণ আমন্ত্রণের প্রকারের উপর নির্ভর করে বিভিন্ন ত্রুটি কোড এবং বার্তা প্রদান করে। রেফারেন্স API প্রতিটি পদ্ধতির ত্রুটির আপ-টু-ডেট বিবরণ প্রদান করে।
আপনি যদি ফায়ারবেস প্রমাণীকরণ কোটায় পৌঁছান, বা কোনো নির্দিষ্ট প্রমাণীকরণ প্রদানকারীকে সক্রিয় না করে থাকেন, যেমন too-many-requests বা operation-not-allowed এর মতো অন্যান্য ত্রুটিগুলি ফেলে দেওয়া হতে পারে।
account-exists-with-different-credential পরিচালনা করা
আপনি যদি Firebase কনসোলে প্রতি ইমেল ঠিকানা সেটিং-এ একটি অ্যাকাউন্ট সক্ষম করে থাকেন, যখন একজন ব্যবহারকারী একটি প্রদানকারীতে (যেমন Google) সাইন ইন করার চেষ্টা করে এমন একটি ইমেল দিয়ে যা ইতিমধ্যেই অন্য Firebase ব্যবহারকারীর প্রদানকারীর (যেমন Facebook) জন্য বিদ্যমান, ত্রুটি auth/account-exists-with-different-credential একটি AuthCredential ক্লাস (Google ID টোকেন) সহ নিক্ষেপ করা হয়। উদ্দেশ্যপ্রণোদিত প্রদানকারীতে সাইন-ইন প্রবাহ সম্পূর্ণ করতে, ব্যবহারকারীকে প্রথমে বিদ্যমান প্রদানকারীতে (যেমন Facebook) সাইন ইন করতে হবে এবং তারপর প্রাক্তন AuthCredential (Google ID টোকেন) এর সাথে লিঙ্ক করতে হবে।
FirebaseAuthauth=FirebaseAuth.instance;// Create a credential from a Google Sign-in RequestvargoogleAuthCredential=GoogleAuthProvider.credential(accessToken:'xxxx');try{// Attempt to sign in the user in with Googleawaitauth.signInWithCredential(googleAuthCredential);}onFirebaseAuthExceptioncatch(e){if(e.code=='account-exists-with-different-credential'){// The account already exists with a different credentialStringemail=e.email;AuthCredentialpendingCredential=e.credential;// Fetch a list of what sign-in methods exist for the conflicting userList<String>userSignInMethods=awaitauth.fetchSignInMethodsForEmail(email);// If the user has several sign-in methods,// the first method in the list will be the "recommended" method to use.if(userSignInMethods.first=='password'){// Prompt the user to enter their passwordStringpassword='...';// Sign the user in to their account with the passwordUserCredentialuserCredential=awaitauth.signInWithEmailAndPassword(email:email,password:password,);// Link the pending credential with the existing accountawaituserCredential.user.linkWithCredential(pendingCredential);// Success! Go back to your application flowreturngoToApplication();}// Since other providers are now external, you must now sign the user in with another// auth provider, such as Facebook.if(userSignInMethods.first=='facebook.com'){// Create a new Facebook credentialStringaccessToken=awaittriggerFacebookAuthentication();varfacebookAuthCredential=FacebookAuthProvider.credential(accessToken);// Sign the user in with the credentialUserCredentialuserCredential=awaitauth.signInWithCredential(facebookAuthCredential);// Link the pending credential with the existing accountawaituserCredential.user.linkWithCredential(pendingCredential);// Success! Go back to your application flowreturngoToApplication();}// Handle other OAuth providers...}}
[[["সহজে বোঝা যায়","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-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# Error Handling\n\n\u003cbr /\u003e\n\nThe Firebase Authentication SDKs provide a simple way for catching the various errors which may occur which using\nauthentication methods. The SDKs for Flutter expose these errors via the `FirebaseAuthException`\nclass.\n\nAt a minimum, a `code` and `message` are provided, however in some cases additional properties such as an email address\nand credential are also provided. For example, if the user is attempting to sign in with an email and password,\nany errors thrown can be explicitly caught: \n\n try {\n await FirebaseAuth.instance.signInWithEmailAndPassword(\n email: \"barry.allen@example.com\",\n password: \"SuperSecretPassword!\"\n );\n } on FirebaseAuthException catch (e) {\n print('Failed with error code: ${e.code}');\n print(e.message);\n }\n\nEach method provides various error codes and messages depending on the type of authentication invocation type. The\n[Reference API](https://pub.dev/documentation/firebase_auth/latest/) provides up-to-date details on the errors for each method.\n\nOther errors such as `too-many-requests` or `operation-not-allowed` may be thrown if you reach the Firebase Authentication quota,\nor have not enabled a specific auth provider.\n\nHandling `account-exists-with-different-credential` Errors\n----------------------------------------------------------\n\nIf you enabled the One account per email address setting in the [Firebase console](https://console.firebase.google.com/project/_/authentication/providers),\nwhen a user tries to sign in a to a provider (such as Google) with an email that already exists for another Firebase user's provider\n(such as Facebook), the error `auth/account-exists-with-different-credential` is thrown along with an `AuthCredential` class (Google ID token).\nTo complete the sign-in flow to the intended provider, the user has to first sign in to the existing provider (e.g. Facebook) and then link to the former\n`AuthCredential` (Google ID token). \n\n FirebaseAuth auth = FirebaseAuth.instance;\n\n // Create a credential from a Google Sign-in Request\n var googleAuthCredential = GoogleAuthProvider.credential(accessToken: 'xxxx');\n\n try {\n // Attempt to sign in the user in with Google\n await auth.signInWithCredential(googleAuthCredential);\n } on FirebaseAuthException catch (e) {\n if (e.code == 'account-exists-with-different-credential') {\n // The account already exists with a different credential\n String email = e.email;\n AuthCredential pendingCredential = e.credential;\n\n // Fetch a list of what sign-in methods exist for the conflicting user\n List\u003cString\u003e userSignInMethods = await auth.fetchSignInMethodsForEmail(email);\n\n // If the user has several sign-in methods,\n // the first method in the list will be the \"recommended\" method to use.\n if (userSignInMethods.first == 'password') {\n // Prompt the user to enter their password\n String password = '...';\n\n // Sign the user in to their account with the password\n UserCredential userCredential = await auth.signInWithEmailAndPassword(\n email: email,\n password: password,\n );\n\n // Link the pending credential with the existing account\n await userCredential.user.linkWithCredential(pendingCredential);\n\n // Success! Go back to your application flow\n return goToApplication();\n }\n\n // Since other providers are now external, you must now sign the user in with another\n // auth provider, such as Facebook.\n if (userSignInMethods.first == 'facebook.com') {\n // Create a new Facebook credential\n String accessToken = await triggerFacebookAuthentication();\n var facebookAuthCredential = FacebookAuthProvider.credential(accessToken);\n\n // Sign the user in with the credential\n UserCredential userCredential = await auth.signInWithCredential(facebookAuthCredential);\n\n // Link the pending credential with the existing account\n await userCredential.user.linkWithCredential(pendingCredential);\n\n // Success! Go back to your application flow\n return goToApplication();\n }\n\n // Handle other OAuth providers...\n }\n }"]]