-
Notifications
You must be signed in to change notification settings - Fork 0
/
callback.html
35 lines (30 loc) · 932 Bytes
/
callback.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>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<script type='text/javascript'>//<![CDATA[
window.onload = function(){
var target = window.self === window.top ? window.opener : window.parent;
var hash = window.location.hash;
if (hash) {
var token = window.location.hash.split('&')[0].split('=')[1];
// target.postMessage(token, 'http://example.com/'); // v0.7.0 and below
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
window.close();
} else
}
}
xmlHttp.open('GET', 'http://api.bungalow.qi/service/spotify/authenticate?code=' + token, true);
xmlHttp.send(null);
}
}//]]>
</script>
</head>
<body>
</body>
</html>