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

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