-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcallback.html
More file actions
25 lines (22 loc) · 780 Bytes
/
callback.html
File metadata and controls
25 lines (22 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!DOCTYPE html>
<html lang="en">
<head>
<script>
function getParameterByName(name) {
var queryString = location.hash.substring(1);
var params = {};
var regex = /([^&=]+)=([^&]*)/g, m;
while (m = regex.exec(queryString)) {
params[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
}
return params['access_token'];
}
var access_token = getParameterByName('access_token');
console.log('access_token', access_token);
if (typeof(access_token) !== 'undefined' && access_token !== null && access_token !== '') {
localStorage.setItem('access_token', access_token);
location.href = '/';
}
</script>
</head>
</html>