Hosting / Authentication

Logging Out

Once a user is authenticated, they can log out at <your-domain>/logout. You can provide a logout button on your authenticated pages with this link.

<a href="/logout">Log out</a>

Custom Routes

CloudCannon sets a cookie when the user is authenticated. Use this to show the logout button for authenticated users on public pages, and hide it otherwise.

No sensitive authentication data is exposed through cookies.

The cookie is used to set a class on the body. The CSS will show the logout button with this class.

var isAuthenticated = document.cookie.indexOf("authenticated=true") >= 0;

if (isAuthenticated) {
  document.body.className += " authenticated";
}
.logout {
  display: none;
}

.authenticated .logout {
  display: block;
}
<a href="/logout" class="logout">Log out</a>
arrow_back

Authentication / Custom Routes

Read previous doc
people

Sharing

Move onto Sharing