Introduction to BrowserID

demo site

http://lab.orinx.com/clipboard/

BrowserID 是什麼?

BrowserID 是

BrowserID的優點

使用BrowserID登入

在自己的網站上使用
BrowserID

大致上的流程

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
)

End!

license


This work is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.