IdentityManager.logout()

Not native
This feature is not built into all browsers. To use it reliably, you'll need to include a JavaScript library in your page as a polyfill. You can include the library from https://login.persona.org/include.js.

Summary

This function is used in Persona to cause the browser to reset the automatic / persistent login flag for a website. After being called, the user will need to explicitly log back into your site instead of being signed in automatically.

Websites must call this function in the click handler for the site's "log out" button.

This function does not make the browser clear the user's certificate and signing key. So after calling logout(), a new login attempt may or may not ask the user for a new password, depending on the freshness of the certificate their identity provider gave them. However, it will certainly prompt the user to select an email address and confirm that they want to sign in.

Syntax

navigator.id.logout();

Example

// Execute navigator.id.logout(); when the user clicks "Sign Out"
var signoutLink = document.getElementById('signout');
if (signoutLink) {
  signoutLink.onclick = function(event) {
    event.preventDefault();
    navigator.id.logout();
  };
};

Specification

Not included in any specification.

See also

Document Tags and Contributors

 Contributors to this page: teoli, MHasan, wbamberg, kscarfone, Sheppy, ethertank, dhesinoiiz, Callahad
 Last updated by: teoli,