Identity/Verified Email Protocol/Latest-Session

From MozillaWiki
Jump to: navigation, search
Note: The Verified Email Protocol has been deprecated. Please check the BrowserID protocol.

So you want to implement the Session API. Great! We're still working on better docs, but so far we have:

  • A tutorial on Shane's blog for how to use it.
  • An API doc
  • The following block of code which shows off most of the API:
// All logic needs to be wrapped in the if( block so that we do not break
// non-supporting browsers.
if( {
  // indicate support - for before the user is logged in. = [];

  // user logged in, no cookies - for once the user is logged in. = [{ email: "" }];

  // user logged in, bound to cookie named SID - for once the user is logged in. = [{
    email: "",
    bound_to: {
      type: "cookie",
      cookie_name: "SID"

  // login/logout events are triggered on document when the user clicks the appropriate button.
  document.addEventListener("login", function(event) {
    // redirect to login page
    document.location.href = ...;
  }, false);

  document.addEventListener("logout", function(event) {
    // redirect to logout page
    document.location.href = ...;
  }, false);