Logging out of the application

In this user story, we will give the users the ability to be able to log out of the application. To implement the logout feature, we will:

  • Add a method to the authenticator module to send a logout request to the server and reload the application
  • Update the view to display the logout link

Let's start by adding a method to the authenticator module. We will name this method logout. This method should send a logout request to the server, clear the token stored in the session, and reload the application. The server invalidates the token on the logout request. Reloading the application will clear it from any data stored about the user. Add this method to the return statement of the authenticator module. Our implementation ...

Get KnockoutJS by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.