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

27 lines
656 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 scope = getParameter("scope") || 'repo,gist';
2013-04-11 22:38:41 +00:00
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="
+ client_id + "&scope=" + scope;
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>