Skip to content

Instantly share code, notes, and snippets.

@LinZap
Created December 9, 2015 19:15
Show Gist options
  • Save LinZap/490c99dae93a0d9fcb26 to your computer and use it in GitHub Desktop.
Save LinZap/490c99dae93a0d9fcb26 to your computer and use it in GitHub Desktop.
Zap_OAuth JavaScript SDK
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>SESSION</title>
</head>
<body>
<button id="btn">請求</button>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script>
(function(d, s, id){
var appid = "123456";
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//10.21.20.85/session/sdk.js.php?appid="+appid;
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'zap-sdk'));
</script>
<script>
$(function(){
$("#btn").click(function(event) {
Zap.login(function(data){
console.log(data);
},'user-profile');
});
});
</script>
</body>
</html>
@LinZap
Copy link
Author

LinZap commented Dec 9, 2015

說明

10.21.20.85/session/

這台是 OAuth Server

10.74.23.144/session/

這台是 Client

詳情

這是前端要用第三方驗證時,真實的寫法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment