Node.js Recipes: A Problem-Solution Approach by Cory Gackenheimer
Author:Cory Gackenheimer [Gackenheimer, Cory]
Language: eng
Format: epub, pdf
Tags: Computers, Web, Web Programming, Programming Languages, General
ISBN: 9781430260585
Google: 1efBnQEACAAJ
Amazon: 1430260580
Publisher: Apress
Published: 2013-10-16T04:00:00+00:00
Listing 6-23. Binding to a Persona Login and Logout
document.querySelector("#login").addEventListener("click", function() {
navigator.id.request();
}, false);
document.querySelector("#logout").addEventListener("click", function() {
navigator.id.logout();
}, false);
Persona also needs you to implement a watch function that will listen for these events. When one is detected, it will send an XMLHttpRequest to the /persona/verify or /persona/logout routes in your Express.js application.
Listing 6-24. Persona Navigator watch Method
navigator.id.watch({
onlogin: function(assertion) {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/persona/verify", true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.addEventListener("loadend", function(e) {
var data = JSON.parse(this.responseText);
if (data && data.status === "okay") {
console.log("You have been logged in as: " + data.email);
}
}, false);
Download
Node.js Recipes: A Problem-Solution Approach by Cory Gackenheimer.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(27118)
Hello! Python by Anthony Briggs(25970)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(25309)
Kotlin in Action by Dmitry Jemerov(24413)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(23612)
Dependency Injection in .NET by Mark Seemann(23326)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(21963)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(20867)
Grails in Action by Glen Smith Peter Ledbrook(19883)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(17081)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(16847)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(14473)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(12595)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(11876)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10656)
Hit Refresh by Satya Nadella(9247)
The Kubernetes Operator Framework Book by Michael Dame(8593)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8449)
Robo-Advisor with Python by Aki Ranin(8393)