Stackedit/github-oauth-client.html
2013-04-13 00:09:34 +01:00

26 lines
600 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 code = getParameter("code");
if (client_id) {
window.location.href = "https://github.com/login/oauth/authorize?client_id="
+ client_id + "&scope=repo";
} else {
if (code) {
localStorage["githubCode"] = code;
}
window.close();
}
</script>
</head>
</html>