-
Notifications
You must be signed in to change notification settings - Fork 1
/
callback.html
29 lines (28 loc) · 965 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
<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Connect with SoundCloud</title>
</head>
<body>
<b style="width: 100%; text-align: center;">This popup should automatically close in a few seconds</b>
<script>
if (window.opener) {
window.opener.setTimeout(window.opener.SC.connectCallback.bind(window));
} else {
var params = window.location.hash.slice(1).split('&');
var token;
for (var i=0; i<params.length; i++) {
var keyval = params[i].split('=');
if (keyval[0] == 'access_token') {
token = keyval[1];
}
}
if (token) {
localStorage.setItem('polymer-sc-oauth', token);
}
window.location.href = window.location.origin +
window.location.pathname.replace(/(.*\/)[^\/]*/, '$1index.build.html#/explore');
}
</script>
</body>
</html>