2018-02-08 16:11:19 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
2018-02-08 16:24:05 +00:00
|
|
|
<meta charset="utf-8">
|
2018-02-08 16:11:19 +00:00
|
|
|
<title>OAuth2 Demo Login</title>
|
2018-02-08 16:38:15 +00:00
|
|
|
<link rel="stylesheet" href="brutalist.css" />
|
2018-02-09 06:45:04 +00:00
|
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
2018-02-08 16:11:19 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<script>
|
|
|
|
function getJsonFromUrl() {
|
2018-02-08 16:52:14 +00:00
|
|
|
var query = location.search.substr(1);
|
|
|
|
var result = {};
|
|
|
|
query.split("&").forEach(function(part) {
|
|
|
|
var item = part.split("=");
|
|
|
|
result[item[0]] = decodeURIComponent(item[1]);
|
|
|
|
});
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
var params=getJsonFromUrl();
|
|
|
|
function jwtDecode(t) {
|
|
|
|
let token = {};
|
|
|
|
token.raw = t;
|
|
|
|
token.header = JSON.parse(window.atob(t.split('.')[0]));
|
|
|
|
token.payload = JSON.parse(window.atob(t.split('.')[1]));
|
|
|
|
return (token)
|
|
|
|
}
|
|
|
|
var jwt=jwtDecode(params.code).payload;
|
2018-02-08 16:11:19 +00:00
|
|
|
</script>
|
|
|
|
<h1>Yolo App login page</h1>
|
|
|
|
<p>Authorization process done!</p>
|
2018-02-08 16:24:05 +00:00
|
|
|
<a href="/index.html">← go back to main page</a>
|
2018-02-08 16:52:14 +00:00
|
|
|
<p>the returned jwt is:</p>
|
|
|
|
<pre class="code"><script>document.write(JSON.stringify(jwt,null,2));</script></pre>
|
|
|
|
<p>decoded from the code:</p>
|
2018-02-08 16:11:19 +00:00
|
|
|
<pre class="code"><script>document.write(params.code);</script></pre>
|
2018-02-09 06:45:04 +00:00
|
|
|
<p>Retrieving Tokens</p>
|
|
|
|
<pre id="token" class="code">Retrive tokens...</pre>
|
|
|
|
<script>
|
|
|
|
var tokparams={
|
|
|
|
"code":params.code
|
|
|
|
, "redirect_uri":"http://localhost:9999/login.html"
|
|
|
|
, "scope":"ctia iroh-collect"
|
|
|
|
, "client_id":"localtest"
|
|
|
|
, "grant_type":"authorization_code"
|
|
|
|
};
|
|
|
|
$.ajax("http://localhost:9001/iroh/oauth2/token"+$.param(tokparams)
|
|
|
|
, function(data){$("#token").html(data);});
|
|
|
|
</script>
|
2018-02-08 16:11:19 +00:00
|
|
|
</body>
|
|
|
|
</html>
|