Stackedit/github-oauth-client.html
2013-04-11 23:38:41 +01:00

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