Identity/Verified Email Protocol/Latest-Session: Difference between revisions
No edit summary |
(Add deprecation notice; point people to BrowserID.) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
So you want to implement the Session API. Great! | {| class="fullwidth-table" | ||
|- | |||
| '''Note: The Verified Email Protocol has been deprecated. Please check the [[Identity/BrowserID|BrowserID]] protocol.''' | |||
|} | |||
So you want to implement the Session API. Great! We're still working on better docs, but so far we have: | |||
* A [http://www.shanetomlinson.com/2011/mozilla-session-api-tutorial/ tutorial] on Shane's blog for how to use it. | |||
* An [[Identity/Verified_Email_Protocol/Session_API|API doc]] | |||
* The following block of code which shows off most of the API: | |||
// All logic needs to be wrapped in the if(navigator.id) block so that we do not break | // All logic needs to be wrapped in the if(navigator.id) block so that we do not break |
Latest revision as of 19:14, 3 April 2012
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(navigator.id) block so that we do not break // non-supporting browsers. if(navigator.id) { // indicate support - for before the user is logged in. navigator.id.sessions = []; // user logged in, no cookies - for once the user is logged in. navigator.id.sessions = [{ email: "user@foo.com" }]; // user logged in, bound to cookie named SID - for once the user is logged in. navigator.id.sessions = [{ email: "user@foo.com", 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); }