An open API service indexing awesome lists of open source software.

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

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.

![Screenshot](https://developer.mozilla.org/@api/deki/files/6051/=browserid-enter-email.png)

![Screenshot](https://developer.mozilla.org/@api/deki/files/6040/=browserid-remote-verify.png)

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:

sign in with browser ID

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