cleaner text
This commit is contained in:
parent
24f013e78f
commit
ad1efc44ca
1 changed files with 15 additions and 15 deletions
30
login.html
30
login.html
|
@ -37,8 +37,8 @@
|
|||
<p>Which once decoded is:</p>
|
||||
<pre class="code"><script>document.write(JSON.stringify(jwt,null,2));</script></pre>
|
||||
<h2>Tokens</h2>
|
||||
<p> Now the server need to retrieve an access-token and a refresh-token
|
||||
using that code.</p>
|
||||
<p> Now the client server need to retrieve an <em>Access Token</em>
|
||||
and a <em>Refresh Token</em> by using that code.</p>
|
||||
<p>To achieve that the client will make a call to <code>/token</code>
|
||||
using a basic auth creds</p>
|
||||
<p>You have about 10 mins to retrieve them.
|
||||
|
@ -56,7 +56,7 @@
|
|||
<h2>Using the API</h2>
|
||||
<div class="button"
|
||||
onclick="makeApiCall();">
|
||||
Visbility API call to <code>/whoami</code>
|
||||
Make an API call with the access token
|
||||
</div>
|
||||
<pre id="apiresponse" class="code">Nothing yet.</pre>
|
||||
<h2>Getting new access token without user interaction</h2>
|
||||
|
@ -84,11 +84,11 @@
|
|||
, "client_id":"localtest"
|
||||
, "grant_type":"authorization_code"
|
||||
};
|
||||
var onTokenError = function(jqXHR,textStatus,errorThrown){
|
||||
var onError = function(jqXHR,textStatus,errorThrown){
|
||||
$('#token').html(errorThrown + " status: " + jqXHR.status
|
||||
+ "\n---\n"
|
||||
+ JSON.stringify(jqXHR.responseJSON,null,2));}
|
||||
var onTokenSuccess = function(data,textStatus,jqXHR) {
|
||||
var onSuccess = function(data,textStatus,jqXHR) {
|
||||
$("#token").html(data
|
||||
+ "\n---\n"
|
||||
+ JSON.stringify(jqXHR.responseJSON,null,2));
|
||||
|
@ -102,8 +102,8 @@
|
|||
$.ajax({
|
||||
type: "POST"
|
||||
, beforeSend: function(request) {request.setRequestHeader("Authorization","Basic localpass")}
|
||||
, success: onTokenSuccess
|
||||
, error: onTokenError
|
||||
, success: onSuccess
|
||||
, error: onError
|
||||
, url: "http://localhost:9001/iroh/oauth2/token"
|
||||
, data: tokparams
|
||||
, contentType: 'application/x-www-form-urlencoded; charset=UTF-8'
|
||||
|
@ -118,11 +118,11 @@
|
|||
, "client_id":"localtest"
|
||||
, "grant_type":"refresh_token"
|
||||
};
|
||||
var onTokenError = function(jqXHR,textStatus,errorThrown){
|
||||
var onError = function(jqXHR,textStatus,errorThrown){
|
||||
$('#refreshed').html(errorThrown + " status: " + jqXHR.status
|
||||
+ "\n---\n"
|
||||
+ JSON.stringify(jqXHR.responseJSON,null,2))}
|
||||
var onTokenSuccess = function(data,textStatus,jqXHR) {
|
||||
var onSuccess = function(data,textStatus,jqXHR) {
|
||||
$("#refreshed").html(data
|
||||
+ "\n---\n"
|
||||
+ JSON.stringify(jqXHR.responseJSON,null,2));
|
||||
|
@ -132,8 +132,8 @@
|
|||
$.ajax({
|
||||
type: "POST"
|
||||
, beforeSend: function(request) {request.setRequestHeader("Authorization","Basic localpass")}
|
||||
, success: onTokenSuccess
|
||||
, error: onTokenError
|
||||
, success: onSuccess
|
||||
, error: onError
|
||||
, url: "http://localhost:9001/iroh/oauth2/token"
|
||||
, data: tokparams
|
||||
, contentType: 'application/x-www-form-urlencoded; charset=UTF-8'
|
||||
|
@ -143,19 +143,19 @@
|
|||
|
||||
var makeApiCall = function() {
|
||||
|
||||
var onTokenError = function(jqXHR,textStatus,errorThrown){
|
||||
var onError = function(jqXHR,textStatus,errorThrown){
|
||||
$('#apiresponse').html(errorThrown + " status: " + jqXHR.status
|
||||
+ "\n---\n"
|
||||
+ JSON.stringify(jqXHR.responseJSON,null,2))}
|
||||
var onTokenSuccess = function(data,textStatus,jqXHR) {
|
||||
var onSuccess = function(data,textStatus,jqXHR) {
|
||||
$("#apiresponse").html(data
|
||||
+ "\n---\n"
|
||||
+ JSON.stringify(jqXHR.responseJSON,null,2));}
|
||||
$.ajax({
|
||||
type: "GET"
|
||||
, beforeSend: function(request) {request.setRequestHeader("Authorization","Bearer " + accessToken)}
|
||||
, success: onTokenSuccess
|
||||
, error: onTokenError
|
||||
, success: onSuccess
|
||||
, error: onError
|
||||
, url: "http://localhost:9001/iroh/iroh-ui-settings/whoami"
|
||||
, contentType: 'application/json'
|
||||
, crossDomain: true
|
||||
|
|
Loading…
Reference in a new issue