Created
September 23, 2015 06:45
-
-
Save explon/88b2e34c93b09b7f2daa to your computer and use it in GitHub Desktop.
SSO 前端例子
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>SSO Demo</title> | |
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> | |
</head> | |
<body> | |
<!-- Passport 登录成功后的处理页面 --> | |
<script type="text/javascript"> | |
var PASSPORT_TOKEN = '[加密后的令牌, 由服务端输出]'; | |
$(document).ready(function () { | |
$.getJSON('http://a.com/sso.php?token=' + PASSPORT_TOKEN + '&jsoncallback=?', function (result) { | |
if (result.state == 'success') | |
{ | |
// SSO 应用登录成功处理 | |
} | |
else if (result.state == 'error') | |
{ | |
// SSO 应用登录失败处理 | |
} | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment