আপনি Firebase প্রমাণীকরণ ব্যবহার করে একজন ব্যবহারকারীকে একটি লিঙ্ক সম্বলিত একটি ইমেল পাঠিয়ে সাইন ইন করতে পারেন, যেটিতে ক্লিক করে তারা সাইন ইন করতে পারে। প্রক্রিয়ায়, ব্যবহারকারীর ইমেল ঠিকানাও যাচাই করা হয়।
ইমেল দ্বারা সাইন ইন করার অনেক সুবিধা রয়েছে:
- কম ঘর্ষণ সাইন আপ এবং সাইন ইন.
- অ্যাপ্লিকেশন জুড়ে পাসওয়ার্ড পুনঃব্যবহারের কম ঝুঁকি, যা এমনকি ভাল-নির্বাচিত পাসওয়ার্ডগুলির নিরাপত্তাকে দুর্বল করতে পারে।
- একজন ব্যবহারকারীকে প্রমাণীকরণ করার ক্ষমতাও যাচাই করে যে ব্যবহারকারী একটি ইমেল ঠিকানার বৈধ মালিক।
- সাইন ইন করার জন্য একজন ব্যবহারকারীর শুধুমাত্র একটি অ্যাক্সেসযোগ্য ইমেল অ্যাকাউন্টের প্রয়োজন হয়৷ কোনও ফোন নম্বর বা সোশ্যাল মিডিয়া অ্যাকাউন্টের মালিকানার প্রয়োজন নেই৷
- একজন ব্যবহারকারী একটি পাসওয়ার্ড প্রদান (বা মনে রাখার) প্রয়োজন ছাড়াই নিরাপদে সাইন ইন করতে পারেন, যা একটি মোবাইল ডিভাইসে কষ্টকর হতে পারে।
- একটি বিদ্যমান ব্যবহারকারী যিনি পূর্বে একটি ইমেল শনাক্তকারী (পাসওয়ার্ড বা ফেডারেটেড) দিয়ে সাইন ইন করেছেন শুধুমাত্র ইমেল দিয়ে সাইন ইন করতে আপগ্রেড করা যেতে পারে৷ উদাহরণ স্বরূপ, যে ব্যবহারকারী তাদের পাসওয়ার্ড ভুলে গেছেন তারা তাদের পাসওয়ার্ড রিসেট না করেই সাইন ইন করতে পারবেন।
তুমি শুরু করার আগে
যদি আপনি ইতিমধ্যে না করে থাকেন, তাহলে Firebase কনসোল থেকে আপনার জাভাস্ক্রিপ্ট প্রোজেক্টে Firebase যোগ করুন -এ বর্ণিত প্রাথমিক স্নিপেটটি আপনার প্রকল্পে অনুলিপি করুন।
আপনার Firebase প্রকল্পের জন্য ইমেল লিঙ্ক সাইন-ইন সক্ষম করুন
ইমেল লিঙ্ক দ্বারা ব্যবহারকারীদের সাইন ইন করতে, আপনাকে প্রথমে আপনার Firebase প্রকল্পের জন্য ইমেল প্রদানকারী এবং ইমেল লিঙ্ক সাইন-ইন পদ্ধতি সক্ষম করতে হবে:
- Firebase কনসোলে , Auth বিভাগটি খুলুন।
- সাইন ইন পদ্ধতি ট্যাবে, ইমেল/পাসওয়ার্ড প্রদানকারী সক্ষম করুন। নোট করুন যে ইমেল লিঙ্ক সাইন-ইন ব্যবহার করার জন্য ইমেল/পাসওয়ার্ড সাইন-ইন অবশ্যই সক্রিয় থাকতে হবে।
- একই বিভাগে, ইমেল লিঙ্ক (পাসওয়ার্ডহীন সাইন-ইন) সাইন-ইন পদ্ধতি সক্ষম করুন।
- সংরক্ষণ করুন ক্লিক করুন.
ব্যবহারকারীর ইমেল ঠিকানায় একটি প্রমাণীকরণ লিঙ্ক পাঠান
প্রমাণীকরণ প্রবাহ শুরু করার জন্য, ব্যবহারকারীকে একটি ইন্টারফেস সহ উপস্থাপন করুন যা ব্যবহারকারীকে তাদের ইমেল ঠিকানা প্রদান করতে অনুরোধ করে এবং তারপরে sendSignInLinkToEmail
কল করে অনুরোধ করে যে Firebase ব্যবহারকারীর ইমেলে প্রমাণীকরণ লিঙ্কটি পাঠায়।
ActionCodeSettings
অবজেক্ট তৈরি করুন, যা Firebase-কে ইমেল লিঙ্ক কীভাবে তৈরি করতে হয় তার নির্দেশাবলী প্রদান করে। নিম্নলিখিত ক্ষেত্র সেট করুন:-
url
: এম্বেড করার গভীর লিঙ্ক এবং যেকোন অতিরিক্ত অবস্থা পাস করতে হবে। লিঙ্কের ডোমেনটিকে অনুমোদিত ডোমেনের Firebase কনসোল তালিকায় যোগ করতে হবে, যা সাইন-ইন পদ্ধতি ট্যাবে গিয়ে (প্রমাণিকরণ -> সাইন-ইন পদ্ধতি) পাওয়া যাবে। -
android
এবংios
: যখন একটি Android বা Apple ডিভাইসে সাইন-ইন লিঙ্ক খোলা হয় তখন যে অ্যাপগুলি ব্যবহার করতে হবে৷ মোবাইল অ্যাপের মাধ্যমে ইমেল অ্যাকশন লিঙ্কগুলি খুলতে Firebase ডায়নামিক লিঙ্কগুলি কীভাবে কনফিগার করবেন সে সম্পর্কে আরও জানুন। -
handleCodeInApp
: সত্যে সেট করুন। সাইন-ইন অপারেশনটি সর্বদা অ্যাপে সম্পূর্ণ করতে হবে অন্য ব্যান্ড ইমেল অ্যাকশনের বিপরীতে (পাসওয়ার্ড রিসেট এবং ইমেল যাচাইকরণ)। এর কারণ হল, প্রবাহের শেষে, ব্যবহারকারী সাইন ইন করবেন বলে আশা করা হচ্ছে এবং অ্যাপের মধ্যে তাদের প্রমাণীকরণ স্থিতি বজায় থাকবে। dynamicLinkDomain
: যখন একটি প্রকল্পের জন্য একাধিক কাস্টম ডায়নামিক লিঙ্ক ডোমেন সংজ্ঞায়িত করা হয়, নির্দিষ্ট মোবাইল অ্যাপের মাধ্যমে লিঙ্কটি খোলার সময় কোনটি ব্যবহার করতে হবে তা উল্লেখ করুন (উদাহরণস্বরূপ,example.page.link
)। অন্যথায় প্রথম ডোমেইন স্বয়ংক্রিয়ভাবে নির্বাচিত হয়।Web version 9
const actionCodeSettings = { // URL you want to redirect back to. The domain (www.example.com) for this // URL must be in the authorized domains list in the Firebase Console. url: 'https://www.example.com/finishSignUp?cartId=1234', // This must be true. handleCodeInApp: true, iOS: { bundleId: 'com.example.ios' }, android: { packageName: 'com.example.android', installApp: true, minimumVersion: '12' }, dynamicLinkDomain: 'example.page.link' };
Web version 8
var actionCodeSettings = { // URL you want to redirect back to. The domain (www.example.com) for this // URL must be in the authorized domains list in the Firebase Console. url: 'https://www.example.com/finishSignUp?cartId=1234', // This must be true. handleCodeInApp: true, iOS: { bundleId: 'com.example.ios' }, android: { packageName: 'com.example.android', installApp: true, minimumVersion: '12' }, dynamicLinkDomain: 'example.page.link' };
ActionCodeSettings সম্পর্কে আরও জানতে, ইমেল অ্যাকশন বিভাগে পাসিং স্টেট পড়ুন।
-
ব্যবহারকারীকে তাদের ইমেলের জন্য জিজ্ঞাসা করুন।
ব্যবহারকারীর ইমেলে প্রমাণীকরণ লিঙ্কটি পাঠান এবং ব্যবহারকারীর ইমেলটি সংরক্ষণ করুন যদি ব্যবহারকারী একই ডিভাইসে ইমেল সাইন-ইন সম্পূর্ণ করেন।
Web version 9
import { getAuth, sendSignInLinkToEmail } from "firebase/auth"; const auth = getAuth(); sendSignInLinkToEmail(auth, email, actionCodeSettings) .then(() => { // The link was successfully sent. Inform the user. // Save the email locally so you don't need to ask the user for it again // if they open the link on the same device. window.localStorage.setItem('emailForSignIn', email); // ... }) .catch((error) => { const errorCode = error.code; const errorMessage = error.message; // ... });
Web version 8
firebase.auth().sendSignInLinkToEmail(email, actionCodeSettings) .then(() => { // The link was successfully sent. Inform the user. // Save the email locally so you don't need to ask the user for it again // if they open the link on the same device. window.localStorage.setItem('emailForSignIn', email); // ... }) .catch((error) => { var errorCode = error.code; var errorMessage = error.message; // ... });
ইমেল লিঙ্ক দিয়ে সাইন ইন সম্পূর্ণ করুন
নিরাপত্তা উদ্বেগ
একটি অনিচ্ছাকৃত ব্যবহারকারী হিসাবে বা একটি অনিচ্ছাকৃত ডিভাইসে সাইন ইন করার জন্য একটি সাইন-ইন লিঙ্ক ব্যবহার করা থেকে প্রতিরোধ করার জন্য, Firebase Auth-এর জন্য সাইন-ইন প্রবাহ সম্পূর্ণ করার সময় ব্যবহারকারীর ইমেল ঠিকানা প্রদান করা প্রয়োজন৷ সাইন-ইন সফল হওয়ার জন্য, এই ইমেল ঠিকানাটি অবশ্যই যে ঠিকানায় সাইন-ইন লিঙ্কটি পাঠানো হয়েছিল তার সাথে মিলতে হবে৷
আপনি এই প্রবাহটিকে প্রবাহিত করতে পারেন যে সমস্ত ব্যবহারকারীরা একই ডিভাইসে সাইন-ইন লিঙ্ক খোলে তারা লিঙ্কটির জন্য অনুরোধ করে, স্থানীয়ভাবে তাদের ইমেল ঠিকানা সংরক্ষণ করে - উদাহরণস্বরূপ স্থানীয় স্টোরেজ বা কুকিজ ব্যবহার করে - আপনি যখন সাইন-ইন ইমেল পাঠান। তারপর, প্রবাহ সম্পূর্ণ করতে এই ঠিকানা ব্যবহার করুন. রিডাইরেক্ট URL প্যারামিটারে ব্যবহারকারীর ইমেল পাস করবেন না এবং এটি পুনরায় ব্যবহার করুন কারণ এটি সেশন ইনজেকশন সক্ষম করতে পারে।
সাইন-ইন সমাপ্তির পরে, সাইন-ইন করার পূর্ববর্তী কোনো যাচাই না করা পদ্ধতি ব্যবহারকারীর কাছ থেকে সরানো হবে এবং বিদ্যমান কোনো সেশন বাতিল করা হবে। উদাহরণ স্বরূপ, যদি কেউ পূর্বে একই ইমেল এবং পাসওয়ার্ড দিয়ে একটি অযাচাই করা অ্যাকাউন্ট তৈরি করে থাকে, তাহলে ব্যবহারকারীর পাসওয়ার্ড সরিয়ে দেওয়া হবে ছদ্মবেশীকে ঠেকাতে যিনি মালিকানা দাবি করেছেন এবং সেই অযাচাই করা অ্যাকাউন্টটি আবার যাচাই করা ইমেল এবং পাসওয়ার্ড দিয়ে সাইন ইন করা থেকে বিরত থাকবে।
এছাড়াও নিশ্চিত করুন যে আপনি প্রোডাকশনে একটি HTTPS URL ব্যবহার করছেন যাতে আপনার লিঙ্কটি মধ্যস্থতাকারী সার্ভারের দ্বারা সম্ভাব্যভাবে বাধা না দেওয়া হয়।
একটি ওয়েব পৃষ্ঠায় সাইন-ইন সম্পূর্ণ করা হচ্ছে
ইমেল লিঙ্ক ডিপ লিঙ্কের বিন্যাসটি ব্যান্ডের বাইরের ইমেল ক্রিয়াগুলির জন্য ব্যবহৃত বিন্যাসের মতোই (ইমেল যাচাইকরণ, পাসওয়ার্ড পুনরায় সেট করা এবং ইমেল পরিবর্তন প্রত্যাহার)। Firebase Auth isSignInWithEmailLink
এপিআই প্রদান করে এই চেকটিকে সহজ করে যে কোনো লিঙ্কটি ইমেল লিঙ্কের সাথে সাইন-ইন কিনা তা পরীক্ষা করতে।
ল্যান্ডিং পৃষ্ঠায় সাইন ইন সম্পূর্ণ করতে, ব্যবহারকারীর ইমেল এবং ওয়ান-টাইম কোড ধারণকারী প্রকৃত ইমেল লিঙ্ক সহ signInWithEmailLink
এ কল করুন।
Web version 9
import { getAuth, isSignInWithEmailLink, signInWithEmailLink } from "firebase/auth"; // Confirm the link is a sign-in with email link. const auth = getAuth(); if (isSignInWithEmailLink(auth, window.location.href)) { // Additional state parameters can also be passed via URL. // This can be used to continue the user's intended action before triggering // the sign-in operation. // Get the email if available. This should be available if the user completes // the flow on the same device where they started it. let email = window.localStorage.getItem('emailForSignIn'); if (!email) { // User opened the link on a different device. To prevent session fixation // attacks, ask the user to provide the associated email again. For example: email = window.prompt('Please provide your email for confirmation'); } // The client SDK will parse the code from the link for you. signInWithEmailLink(auth, email, window.location.href) .then((result) => { // Clear email from storage. window.localStorage.removeItem('emailForSignIn'); // You can access the new user via result.user // Additional user info profile not available via: // result.additionalUserInfo.profile == null // You can check if the user is new or existing: // result.additionalUserInfo.isNewUser }) .catch((error) => { // Some error occurred, you can inspect the code: error.code // Common errors could be invalid email and invalid or expired OTPs. }); }
Web version 8
// Confirm the link is a sign-in with email link. if (firebase.auth().isSignInWithEmailLink(window.location.href)) { // Additional state parameters can also be passed via URL. // This can be used to continue the user's intended action before triggering // the sign-in operation. // Get the email if available. This should be available if the user completes // the flow on the same device where they started it. var email = window.localStorage.getItem('emailForSignIn'); if (!email) { // User opened the link on a different device. To prevent session fixation // attacks, ask the user to provide the associated email again. For example: email = window.prompt('Please provide your email for confirmation'); } // The client SDK will parse the code from the link for you. firebase.auth().signInWithEmailLink(email, window.location.href) .then((result) => { // Clear email from storage. window.localStorage.removeItem('emailForSignIn'); // You can access the new user via result.user // Additional user info profile not available via: // result.additionalUserInfo.profile == null // You can check if the user is new or existing: // result.additionalUserInfo.isNewUser }) .catch((error) => { // Some error occurred, you can inspect the code: error.code // Common errors could be invalid email and invalid or expired OTPs. }); }
একটি মোবাইল অ্যাপে সাইন-ইন সম্পূর্ণ করা হচ্ছে
Firebase প্রমাণীকরণ একটি মোবাইল ডিভাইসে ইমেল লিঙ্ক পাঠাতে Firebase ডায়নামিক লিঙ্ক ব্যবহার করে। মোবাইল অ্যাপ্লিকেশনের মাধ্যমে সাইন-ইন সম্পূর্ণ করার জন্য, অ্যাপ্লিকেশনটিকে ইনকামিং অ্যাপ্লিকেশন লিঙ্ক শনাক্ত করতে কনফিগার করতে হবে, অন্তর্নিহিত গভীর লিঙ্কটি পার্স করতে হবে এবং তারপর সাইন-ইন সম্পূর্ণ করতে হবে যেমনটি ওয়েব ফ্লো এর মাধ্যমে করা হয়।
একটি অ্যান্ড্রয়েড অ্যাপ্লিকেশনে ইমেল লিঙ্কের মাধ্যমে সাইন-ইন কীভাবে পরিচালনা করবেন সে সম্পর্কে আরও জানতে, Android গাইড পড়ুন।
একটি Apple অ্যাপ্লিকেশনে ইমেল লিঙ্কের মাধ্যমে সাইন-ইন কীভাবে পরিচালনা করবেন সে সম্পর্কে আরও জানতে, Apple প্ল্যাটফর্ম নির্দেশিকা পড়ুন।
ইমেল লিঙ্কের সাথে লিঙ্ক করা/পুনরায় প্রমাণীকরণ
আপনি একটি বিদ্যমান ব্যবহারকারীর সাথে প্রমাণীকরণের এই পদ্ধতিটি লিঙ্ক করতে পারেন। উদাহরণস্বরূপ, একজন ব্যবহারকারী পূর্বে অন্য প্রদানকারীর সাথে প্রমাণীকরণ করেছেন, যেমন একটি ফোন নম্বর, তাদের বিদ্যমান অ্যাকাউন্টে সাইন-ইন করার এই পদ্ধতিটি যোগ করতে পারে৷
পার্থক্যটি অপারেশনের দ্বিতীয়ার্ধে হবে:
Web version 9
import { getAuth, linkWithCredential, EmailAuthProvider } from "firebase/auth"; // Construct the email link credential from the current URL. const credential = EmailAuthProvider.credentialWithLink( email, window.location.href); // Link the credential to the current user. const auth = getAuth(); linkWithCredential(auth.currentUser, credential) .then((usercred) => { // The provider is now successfully linked. // The phone user can now sign in with their phone number or email. }) .catch((error) => { // Some error occurred. });
Web version 8
// Construct the email link credential from the current URL. var credential = firebase.auth.EmailAuthProvider.credentialWithLink( email, window.location.href); // Link the credential to the current user. firebase.auth().currentUser.linkWithCredential(credential) .then((usercred) => { // The provider is now successfully linked. // The phone user can now sign in with their phone number or email. }) .catch((error) => { // Some error occurred. });
এটি একটি সংবেদনশীল অপারেশন চালানোর আগে একটি ইমেল লিঙ্ক ব্যবহারকারীকে পুনরায় প্রমাণীকরণ করতে ব্যবহার করা যেতে পারে।
Web version 9
import { getAuth, reauthenticateWithCredential, EmailAuthProvider } from "firebase/auth"; // Construct the email link credential from the current URL. const credential = EmailAuthProvider.credentialWithLink( email, window.location.href); // Re-authenticate the user with this credential. const auth = getAuth(); reauthenticateWithCredential(auth.currentUser, credential) .then((usercred) => { // The user is now successfully re-authenticated and can execute sensitive // operations. }) .catch((error) => { // Some error occurred. });
Web version 8
// Construct the email link credential from the current URL. var credential = firebase.auth.EmailAuthProvider.credentialWithLink( email, window.location.href); // Re-authenticate the user with this credential. firebase.auth().currentUser.reauthenticateWithCredential(credential) .then((usercred) => { // The user is now successfully re-authenticated and can execute sensitive // operations. }) .catch((error) => { // Some error occurred. });
যাইহোক, যেহেতু প্রবাহটি একটি ভিন্ন ডিভাইসে শেষ হতে পারে যেখানে আসল ব্যবহারকারী লগ ইন করা হয়নি, এই প্রবাহটি সম্পূর্ণ নাও হতে পারে৷ সেই ক্ষেত্রে, ব্যবহারকারীকে একই ডিভাইসে লিঙ্ক খুলতে বাধ্য করার জন্য একটি ত্রুটি দেখানো হতে পারে। অপারেশনের ধরন এবং ব্যবহারকারীর uid সম্পর্কে তথ্য প্রদানের জন্য লিঙ্কটিতে কিছু রাজ্য পাস করা যেতে পারে।
ইমেল লিঙ্ক থেকে ইমেল/পাসওয়ার্ডের পার্থক্য
আপনি যদি ইমেলের মাধ্যমে পাসওয়ার্ড এবং লিঙ্ক-ভিত্তিক সাইন-ইন উভয়কেই সমর্থন করেন, পাসওয়ার্ড/লিঙ্ক ব্যবহারকারীর জন্য সাইন-ইন করার পদ্ধতিকে আলাদা করতে, fetchSignInMethodsForEmail
ব্যবহার করুন। এটি শনাক্তকারী-প্রথম প্রবাহের জন্য দরকারী যেখানে ব্যবহারকারীকে প্রথমে তাদের ইমেল প্রদান করতে বলা হয় এবং তারপর সাইন-ইন করার পদ্ধতির সাথে উপস্থাপন করা হয়:
Web version 9
import { getAuth, fetchSignInMethodsForEmail, EmailAuthProvider} from "firebase/auth"; // After asking the user for their email. const email = window.prompt('Please provide your email'); const auth = getAuth(); fetchSignInMethodsForEmail(auth, email) .then((signInMethods) => { // This returns the same array as fetchProvidersForEmail but for email // provider identified by 'password' string, signInMethods would contain 2 // different strings: // 'emailLink' if the user previously signed in with an email/link // 'password' if the user has a password. // A user could have both. if (signInMethods.indexOf(EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD) != -1) { // User can sign in with email/password. } if (signInMethods.indexOf(EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD) != -1) { // User can sign in with email/link. } }) .catch((error) => { // Some error occurred, you can inspect the code: error.code });
Web version 8
// After asking the user for their email. var email = window.prompt('Please provide your email'); firebase.auth().fetchSignInMethodsForEmail(email) .then((signInMethods) => { // This returns the same array as fetchProvidersForEmail but for email // provider identified by 'password' string, signInMethods would contain 2 // different strings: // 'emailLink' if the user previously signed in with an email/link // 'password' if the user has a password. // A user could have both. if (signInMethods.indexOf( firebase.auth.EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD) != -1) { // User can sign in with email/password. } if (signInMethods.indexOf( firebase.auth.EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD) != -1) { // User can sign in with email/link. } }) .catch((error) => { // Some error occurred, you can inspect the code: error.code });
উপরে বর্ণিত ইমেল/পাসওয়ার্ড এবং ইমেল/লিঙ্কগুলিকে সাইন-ইন করার বিভিন্ন পদ্ধতি সহ একই firebase.auth.EmailAuthProvider
(একই PROVIDER_ID
) হিসাবে বিবেচনা করা হয়৷
পরবর্তী পদক্ষেপ
একজন ব্যবহারকারী প্রথমবার সাইন ইন করার পরে, একটি নতুন ব্যবহারকারীর অ্যাকাউন্ট তৈরি করা হয় এবং শংসাপত্রগুলির সাথে লিঙ্ক করা হয়—অর্থাৎ, ব্যবহারকারীর নাম এবং পাসওয়ার্ড, ফোন নম্বর, বা প্রমাণ প্রদানকারীর তথ্য — ব্যবহারকারী সাইন ইন করেছেন। এই নতুন অ্যাকাউন্টটি আপনার ফায়ারবেস প্রকল্পের অংশ হিসাবে সংরক্ষণ করা হয়েছে, এবং ব্যবহারকারী কীভাবে সাইন ইন করুন না কেন, আপনার প্রকল্পের প্রতিটি অ্যাপ জুড়ে একজন ব্যবহারকারীকে সনাক্ত করতে ব্যবহার করা যেতে পারে।
আপনার অ্যাপে, আপনার ব্যবহারকারীর প্রমাণীকরণের স্থিতি জানার প্রস্তাবিত উপায় হল
Auth
অবজেক্টে একজন পর্যবেক্ষক সেট করা। তারপর আপনিUser
অবজেক্ট থেকে ব্যবহারকারীর মৌলিক প্রোফাইল তথ্য পেতে পারেন। ব্যবহারকারীদের পরিচালনা দেখুন।আপনার ফায়ারবেস রিয়েলটাইম ডেটাবেস এবং ক্লাউড স্টোরেজ নিরাপত্তা নিয়মে , আপনি
auth
ভেরিয়েবল থেকে সাইন-ইন করা ব্যবহারকারীর অনন্য ব্যবহারকারী আইডি পেতে পারেন এবং ব্যবহারকারী কোন ডেটা অ্যাক্সেস করতে পারে তা নিয়ন্ত্রণ করতে এটি ব্যবহার করতে পারেন।
একজন ব্যবহারকারীকে সাইন আউট করতে, signOut
কল করুন:
Web version 9
import { getAuth, signOut } from "firebase/auth"; const auth = getAuth(); signOut(auth).then(() => { // Sign-out successful. }).catch((error) => { // An error happened. });
Web version 8
firebase.auth().signOut().then(() => { // Sign-out successful. }).catch((error) => { // An error happened. });