-
-
Save oscarfroberg/1974865 to your computer and use it in GitHub Desktop.
Basic browserid functions for serverside use
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setCookie(c_name, value, exdays) { | |
var exdate = new Date(); | |
exdate.setDate(exdate.getDate() + exdays); | |
var c_value = escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); | |
document.cookie = c_name + "=" + c_value; | |
} | |
function browserid_login_callback(assertion){ | |
setCookie('browserid_assertion', assertion, 90); | |
window.location.reload(); | |
} | |
function browserid_login(){ | |
navigator.id.getVerifiedEmail(browserid_login_callback); | |
} | |
function browserid_logout(){ | |
setCookie('browserid_assertion', 'x', -30); | |
window.location.reload() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment