https://github.com/thinkphp/browserid
BrowserID Library verifier for PHP5
https://github.com/thinkphp/browserid
Last synced: 3 months ago
JSON representation
BrowserID Library verifier for PHP5
- Host: GitHub
- URL: https://github.com/thinkphp/browserid
- Owner: thinkphp
- Created: 2012-03-18T07:22:55.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2012-03-18T15:52:13.000Z (almost 14 years ago)
- Last Synced: 2024-04-14T14:54:23.106Z (almost 2 years ago)
- Language: PHP
- Homepage: http://thinkphp.ro/apps/php-hacks/browserID/cURL/
- Size: 97.7 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
BrowserID
=========
BrowserID is a new way for users to log into web sites using their email address. It aims to provide a secure way of proving your identity to servers across the internet,
without having to create separate usernames and passwords each time. Instead of a new username, it uses your email address as you identity which allows it to be
descentralized since anyone can send you an email verification message.


How to Use
----------
Include the BrowserID include.js library in your site by adding the following script tag to your pages:
#head
Adding pretty button:

When DOM is ready:
#JS
var $ = function(id){return document.getElementById(id);},
login = $("login")
addEvent(login,'click',function(){
navigator.id.getVerifiedEmail(function(assertion) {
if(assertion) {
verify(assertion);
} else {
alert('I still don\'t know you...');
}
})
},false)
function verify(assertion) {
var params = 'assertion=' + assertion,
url = 'login.php'
asyncRequest.REQUEST("POST",url,function(data){
var response = JSON.parse(data),
p = document.createElement('p')
p.innerHTML = 'Welcome, ' + response.email
butt.parentNode.replaceChild(p,login)
$('result').innerHTML = 'WoW, I know you!'
}, params)
}
#PHP
require_once('login.class.php');
$browserID = new BrowserID($_SERVER['HTTP_HOST'], $_POST['assertion']);
if($browserID->verify_assertion()) {
echo json_encode(array('status'=>'okay', 'email'=>$browserID->getEmail()));
} else {
echo json_encode(array('status'=>'failure'));
}
References:
- https://browserid.org/
- https://developer.mozilla.org/en/BrowserID
- https://browserid.org/developers
- http://identity.mozilla.com/post/7616727542/introducing-browserid-a-better-way-to-sign-in
- http://identity.mozilla.com/post/17207734786/id-provider-support-now-live-on-browserid
- https://github.com/mozilla/browserid/wiki