Stackedit/public/html/github-oauth-client.html

27 lines
656 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
function getParameter(name) {
var regex = new RegExp(name + "=(.+?)(&|$)");
try {
return decodeURI(regex.exec(location.search)[1]);
} catch (e) {
return undefined;
}
}
var client_id = getParameter("client_id");
var scope = getParameter("scope") || 'repo,gist';
var code = getParameter("code");
if (client_id) {
window.location.href = "https://github.com/login/oauth/authorize?client_id="
+ client_id + "&scope=" + scope;
} else {
if (code) {
localStorage["githubCode"] = code;
}
window.close();
}
</script>
</head>
</html>