Stackedit/github-oauth-client.html

24 lines
589 B
HTML
Raw 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");
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>