adding token retrieving

This commit is contained in:
Yann Esposito (Yogsototh) 2018-02-09 07:45:04 +01:00
parent 89c346f512
commit 9fecc54743
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
3 changed files with 19 additions and 5 deletions

View file

@ -12,7 +12,7 @@ body {
padding: 2em;
display: block;
color: #586e75;
margin: 2em auto 0;
margin: 2em auto;
max-width: 45em;
font-family: Consolas, Menlo, monospace;
line-height: 1.2em;

View file

@ -5,9 +5,9 @@
</head>
<body>
<h1>Yolo App</h1>
<a class="button" href="http://localhost:9001/iroh/oauth2/authorize?response_type=code&client_id=localtest&redirect_uri=http%3A%2F%2Flocalhost%3A9999%2Flogin.html&scope=ctia%20iroh-collect&state=yolo" target="_blank">
click Here
</a> to authorize me with the scopes:
<a class="button"
href="http://localhost:9001/iroh/oauth2/authorize?response_type=code&client_id=localtest&redirect_uri=http%3A%2F%2Flocalhost%3A9999%2Flogin.html&scope=ctia%20iroh-collect&state=yolo"
>click Here</a> to authorize me with the scopes:
<ul><li><code>ctia</code></li>
<li><code>iroh-collect</code></li>
</ul>

View file

@ -3,6 +3,7 @@
<meta charset="utf-8">
<title>OAuth2 Demo Login</title>
<link rel="stylesheet" href="brutalist.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<script>
@ -32,5 +33,18 @@
<pre class="code"><script>document.write(JSON.stringify(jwt,null,2));</script></pre>
<p>decoded from the code:</p>
<pre class="code"><script>document.write(params.code);</script></pre>
<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>
</body>
</html>