adding token retrieving
This commit is contained in:
parent
89c346f512
commit
9fecc54743
3 changed files with 19 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
</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:
|
||||
<ul><li> <code>ctia</code></li>
|
||||
<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>
|
||||
</body>
|
||||
|
|
14
login.html
14
login.html
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue