# Logout Button

# Purpose

The purpose of the Logout Button is to allow a logged in user to log out.

Logout Button

When a user logs out, they are redirected to the URL of your choice (default is /login). Their access token is removed from the browser and also invalidated on Userfront.

# Usage


For your live sites, always use https:// (also called SSL).
If your URL begins with http://, it is not secure.

The Logout Button does the following when clicked:

  1. Invalidates the user's access token with Userfront, so that it is no longer valid.
  2. Removes the user's access token from their browser. The token is a cookie named access.${projectId}; for example, if your project ID was abcdefg, the token would be access.abcdefg.
  3. Redirects the user to the designated logout page.

Add your Logout Button to pages where you want your users to be able to log out. You can add multiple Logout Buttons to the same page, and can also add the Logout Button to many different pages if desired.

# Redirection

When a user clicks the Logout Button, they are redirected to the URL of your choice. The default is /login, but you can change it in your project's settings:

Logout URL

When defined as a relative path like /login, the user will be redirected whatever domain the button is on, plus that path.

For example, placing the Logout Button at https://example.com/random, and defining the redirection path to be /login will redirect the user to https://example.com/login once the button is clicked.

Last Updated: 7/25/2020, 8:12:23 PM