-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
132 lines (121 loc) · 4.74 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<!-- Copyright 2014 Open Ag Data Alliance
Licensed under the Apache License, Version 2.0 (the 'License');
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<title>In Browser Usage Example Page</title>
<script src="bundle.js"></script>
<script src="http://medialize.github.io/URI.js/src/URI.js"></script>
<link
rel="stylesheet"
href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.2/styles/default.min.css"
/>
<script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.2/highlight.min.js"></script>
<script>
var options = {
metadata:
'eyJqa3UiOiJodHRwczovL2lkZW50aXR5Lm9hZGEtZGV2LmNvbS9jZX' +
'J0cyIsImtpZCI6ImtqY1NjamMzMmR3SlhYTEpEczNyMTI0c2ExIiwi' +
'dHlwIjoiSldUIiwiYWxnIjoiUlMyNTYifQ.eyJyZWRpcmVjdF91cml' +
'zIjpbImh0dHA6Ly9sb2NhbGhvc3Q6MzAwNy9yZWRpcmVjdC5odG1sI' +
'l0sInRva2VuX2VuZHBvaW50X2F1dGhfbWV0aG9kIjoidXJuOmlldGY' +
'6cGFyYW1zO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-A',
scope: 'bookmarks.machines.harvesters',
params: {
// Make it always ask for consent again
prompt: 'consent',
},
};
var googleOptions = {
metadata: {
client_id:
'222922449179-va3k4ldqsg9aq5kmv4db8jvlijvv5s8p' +
'.apps.googleusercontent.com',
redirect_uri: URI('redirect.html').absoluteTo(window.location.href),
},
scope: 'https://mail.google.com/',
params: {
// Make it always ask for consent again
prompt: 'consent',
},
};
var callback = function (err, token) {
'use strict';
if (err) {
if (console && typeof console.dir === 'function') {
console.dir(err);
}
alert(err.name + ':' + err.message);
}
var block = document.getElementById('token');
block.innerHTML = JSON.stringify(token, undefined, 4);
hljs.highlightBlock(block);
};
function secret() {
'use strict';
if (URI(window.location.href).hasQuery('secret')) {
document.getElementById('secret').style.display = 'block';
}
}
</script>
</head>
<body onload="secret()">
<button
id="get_id"
onclick="oadaIdClient.getIDToken(
'identity.oada-dev.com', options, callback)"
>
ID Token
</button>
<button
id="get_access"
onclick="oadaIdClient.getAccessToken(
'identity.oada-dev.com', options, callback)"
>
Access Token
</button>
<div id="secret" style="display: none">
<!-- The contents of this div only work if you know how to un-break them -->
<button
onclick="oadaIdClient.getIDToken('vip1.ecn.purdue.edu/~awlayton',
googleOptions, callback)"
>
Google ID Token
</button>
<button
onclick="oadaIdClient.getAccessToken('vip1.ecn.purdue.edu/~awlayton',
googleOptions, callback)"
>
Google Access Token
</button>
</div>
<pre class="json" id="token"></pre>
</body>
</html>