Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
SSO 前端例子
<!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