From the course: Vue.js: Creating and Hosting a Full-Stack Site
Unlock this course with a free trial
Join today to access over 25,600 courses taught by industry experts.
Signing the user out
From the course: Vue.js: Creating and Hosting a Full-Stack Site
Signing the user out
- [Instructor] All right, so now that we've allowed our user to log in and we've subscribed to authentication state changes, the next thing that we're going to have to do in order to make testing easier from now on is make it possible for our users to log out. So what we're going to do here is add a simple sign out button to the top of our nav bar, and what that's going to involve is just opening up our nav bar component. And then what we're going to do is we're going to start off by importing the "getAuth" function from Firebase Auth, as well as the "signOut" function. So we'll import those from "firebase/auth" And then down here in our nav bar, what we're going to want to do is create a method for signing out. So we'll say "methods:", then we'll create a "signOut" method, like so. And inside here all we're going to have to do is say "const auth = getAuth()" and then we'll say "signOut(auth)". So that's going to call…
Contents
-
-
-
-
-
-
-
(Locked)
Why Firebase Authentication?1m 53s
-
(Locked)
Creating a Firebase project6m 31s
-
(Locked)
Sending Firebase Auth email links5m 43s
-
(Locked)
Logging in with an email link6m 23s
-
(Locked)
Listening for auth state changes5m 53s
-
(Locked)
Signing the user out5m 14s
-
(Locked)
Managing cart items with authentication7m 25s
-
(Locked)
-
-