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

26 lines
605 B
HTML
Raw Permalink Normal View History

2013-04-11 22:38:41 +00:00
<!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 code = getParameter("code");
2013-04-12 23:09:34 +00:00
if (client_id) {
2013-04-11 22:38:41 +00:00
window.location.href = "https://github.com/login/oauth/authorize?client_id="
2013-04-29 23:19:54 +00:00
+ client_id + "&scope=repo,gist";
2013-04-12 23:09:34 +00:00
} else {
if (code) {
localStorage["githubCode"] = code;
}
window.close();
2013-04-11 22:38:41 +00:00
}
</script>
</head>
</html>