Stackedit/public/html/wordpress-oauth-client.html
2013-10-06 21:26:11 +01:00

27 lines
699 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) {
var redirectURI = location.href.substring(0, location.href.indexOf("?"));
window.location.href = "https://public-api.wordpress.com/oauth2/authorize?response_type=code&client_id="
+ client_id + "&redirect_uri=" + redirectURI;
} else {
if (code) {
localStorage["wordpressCode"] = code;
}
window.close();
}
</script>
</head>
</html>