Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b4a881d
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# authing-sso-demo | ||
|
||
使用 Authing 实现 SSO。 | ||
|
||
## 运行此程序 | ||
|
||
```shell | ||
$ http-server | ||
``` | ||
|
||
访问:[http://locahost:8080](http://locahost:8080) 即可。 | ||
|
||
## 开发教程 | ||
|
||
开发教程请参考:[使用 Authing 实现单点登录](https://docs.authing.cn/authing/quickstart/implement-sso-with-authing)。 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | ||
<title>Authing SSO Example</title> | ||
</head> | ||
<body> | ||
<button id="btn-login">login</button> | ||
<button id="btn-track-session">trackSession</button> | ||
<button id="btn-logout">logout</button> | ||
<script src="https://cdn.jsdelivr.net/npm/@authing/sso/dist/SSO.umd.min.js"></script> | ||
<script> | ||
let auth = new SSO({ | ||
appId: "5cded9bf4efab36f02fa666a", | ||
appType: "oidc", | ||
appDomain: "first-oidc-app.authing.cn" | ||
}); | ||
let login = document.getElementById("btn-login"); | ||
let trackSession = document.getElementById("btn-track-session"); | ||
let logout = document.getElementById("btn-logout"); | ||
login.onclick = function() { | ||
auth.login(); | ||
}; | ||
trackSession.onclick = async function() { | ||
let res = await auth.trackSession(); | ||
alert(JSON.stringify(res)); | ||
}; | ||
logout.onclick = async function() { | ||
let res = await auth.logout(); | ||
alert(JSON.stringify(res)); | ||
}; | ||
</script> | ||
</body> | ||
</html> |