37 lines
1017 B
HTML
37 lines
1017 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<body>
|
|
<script>
|
|
var state;
|
|
var accessToken;
|
|
var code;
|
|
var expiresIn;
|
|
function parse(search) {
|
|
(search || '').slice(1).split('&').forEach(function (param) {
|
|
var split = param.split('=');
|
|
var key = decodeURIComponent(split.shift());
|
|
var value = decodeURIComponent(split.join('='));
|
|
if (key === 'state') {
|
|
state = value;
|
|
} else if (key === 'access_token') {
|
|
accessToken = value;
|
|
} else if (key === 'code') {
|
|
code = value;
|
|
} else if (key === 'expires_in') {
|
|
expiresIn = value;
|
|
}
|
|
});
|
|
}
|
|
parse(location.search);
|
|
parse(location.hash);
|
|
var origin = location.protocol + '//' + location.host;
|
|
(window.opener || window.parent).postMessage({
|
|
state: state,
|
|
accessToken: accessToken,
|
|
code: code,
|
|
expiresIn: expiresIn
|
|
}, origin);
|
|
</script>
|
|
</body>
|
|
</html>
|