forked from webida/webida-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.html
35 lines (32 loc) · 1.01 KB
/
auth.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html>
<html>
<head>
<script src="./common/src/webida/util/browserUtil.global.js"></script>
<script>
sendMessage(parseHash().access_token);
function parseHash(){
var result = {};
if(location.hash) {
var tokens = location.hash.substring(1).split('&');
for(var i=0; i<tokens.length; i++){
var kv = tokens[i].split('=');
result[kv[0]] = (kv.length > 1) ? decodeURIComponent(kv[1]) : '';
}
}
return result;
}
function sendMessage(accessToken){
var targetOrigin = BrowserUtil.getLocationOrigin();
if (!window.opener) {
window.parent.postMessage(accessToken, targetOrigin);
} else {
window.opener.parent.postMessage(accessToken, targetOrigin);
self.opener = self;
window.close();
}
}
</script>
</head>
<body>
</body>
</html>