Introduction to BrowserID
Introduction to BrowserID
demo site
http://lab.orinx.com/clipboard/
BrowserID 是
- Mozilla推出的身份認證系統
- 一個去中心化的網上身份認證系統
1.在網頁內引入BrowserID的js
<script
src="https://browserid.org/include.js" type="text/javascript"></script>
2.接收BrowserID的assertion
navigator.id.get(function(assertion) {
if (assertion) {
window.location="verify/?assertion=" + assertion;
}
}
3.以assertion要求資料
$post_url = 'https://browserid.org/verify';
$post_data = "assertion=".$assertion."&&".
"audience=".$url;
$c = curl_init ($post_url);
curl_setopt ($c, CURLOPT_POST, true);
curl_setopt ($c, CURLOPT_POSTFIELDS, $post_data);
curl_setopt ($c, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec ($c);
4.decode JSON 完成!
(
[status] => okay
[email] => orinx@orinx.com
[audience] => lab.orinx.com
[expires] => 1331320832122
[issuer] => browserid.org
)