forked from auth0-samples/auth0-javascript-samples
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
308 lines (285 loc) · 11.2 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
<!DOCTYPE html>
<html class="h-100">
<head>
<meta charset="UTF-8" />
<title>SPA SDK Sample</title>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
/>
<link rel="stylesheet" type="text/css" href="/css/main.css" />
<link
rel="stylesheet"
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/monokai-sublime.min.css"
/>
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.7.2/css/solid.css"
integrity="sha384-r/k8YTFqmlOaqRkZuSiE9trsrDXkh07mRaoGBMoDcmA58OHILZPsk29i2BsFng1B"
crossorigin="anonymous"
/>
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.7.2/css/fontawesome.css"
integrity="sha384-4aon80D8rXCGx9ayDt85LbyUHeMWd3UiBaWliBlJ53yzm9hqN21A+o1pqoyK04h+"
crossorigin="anonymous"
/>
<link
rel="stylesheet"
href="https://cdn.auth0.com/js/auth0-samples-theme/1.0/css/auth0-theme.min.css"
/>
</head>
<body class="h-100">
<div id="app" class="h-100 d-flex flex-column">
<div class="nav-container">
<nav class="navbar navbar-expand-md navbar-light bg-light">
<div class="container">
<div class="navbar-brand logo"></div>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a href="/" class="nav-link route-link">Home</a>
</li>
<li class="nav-item">
<a
href="/external-api"
class="nav-link route-link hidden auth-visible"
>External API</a
>
</li>
</ul>
<ul class="navbar-nav d-none d-md-block">
<!-- Login button: show if NOT authenticated -->
<li class="nav-item auth-invisible">
<button
id="qsLoginBtn"
onclick="login()"
class="btn btn-primary btn-margin auth-invisible hidden"
>
Log in
</button>
</li>
<!-- / Login button -->
<!-- Fullsize dropdown: show if authenticated -->
<li class="nav-item dropdown auth-visible hidden">
<a
class="nav-link dropdown-toggle"
href="#"
id="profileDropDown"
data-toggle="dropdown"
>
<!-- Profile image should be set to the profile picture from the id token -->
<img
alt="Profile picture"
class="nav-user-profile profile-image rounded-circle"
width="50"
/>
</a>
<div class="dropdown-menu">
<!-- Show the user's full name from the id token here -->
<div class="dropdown-header nav-user-name user-name"></div>
<a
href="/profile"
class="dropdown-item dropdown-profile route-link"
>
<i class="fas fa-user mr-3"></i> Profile
</a>
<a
href="#"
class="dropdown-item"
id="qsLogoutBtn"
onclick="logout()"
>
<i class="fas fa-power-off mr-3"></i> Log out
</a>
</div>
</li>
<!-- /Fullsize dropdown -->
</ul>
<!-- Responsive login button: show if NOT authenticated -->
<ul class="navbar-nav d-md-none auth-invisible">
<button
class="btn btn-primary btn-block auth-invisible hidden"
id="qsLoginBtn"
onclick="login()"
>
Log in
</button>
</ul>
<!-- /Responsive login button -->
<!-- Responsive profile dropdown: show if authenticated -->
<ul
class="navbar-nav d-md-none auth-visible hidden justify-content-between"
style="min-height: 125px"
>
<li class="nav-item">
<span class="user-info">
<!-- Profile image should be set to the profile picture from the id token -->
<img
alt="Profile picture"
class="nav-user-profile d-inline-block profile-image rounded-circle mr-3"
width="50"
/>
<!-- Show the user's full name from the id token here -->
<h6 class="d-inline-block nav-user-name user-name"></h6>
</span>
</li>
<li>
<i class="fas fa-user mr-3"></i>
<a href="/profile" class="route-link">Profile</a>
</li>
<li>
<i class="fas fa-power-off mr-3"></i>
<a href="#" id="qsLogoutBtn" onclick="logout()">Log out</a>
</li>
</ul>
</div>
</div>
</nav>
</div>
<div id="main-content" class="container mt-5 flex-grow-1">
<div id="content-home" class="page">
<div class="text-center hero">
<img
class="mb-3 app-logo"
src="/images/logo.png"
alt="JavaScript logo"
width="75"
/>
<h1 class="mb-4">JavaScript Sample Project</h1>
<p class="lead">
This is a sample application that demonstrates an authentication
flow for an SPA, using plain JavaScript
</p>
</div>
<div class="next-steps">
<h2 class="my-5 text-center">What can I do next?</h2>
<div class="row">
<div class="col-md-5 mb-4">
<h6 class="mb-3">
<a href="https://auth0.com/docs/connections">
<i class="fas fa-link"></i> Configure other identity
providers
</a>
</h6>
<p>
Auth0 supports social providers as Facebook, Twitter,
Instagram and 100+, Enterprise providers as Microsoft Office
365, Google Apps, Azure, and more. You can also use any OAuth2
Authorization Server.
</p>
</div>
<div class="col-md"></div>
<div class="col-md-5 mb-4">
<h6 class="mb-3">
<a href="https://auth0.com/docs/multifactor-authentication">
<i class="fas fa-link"></i> Enable Multifactor
Authentication
</a>
</h6>
<p>
Add an extra layer of security by enabling Multi-factor
Authentication, requiring your users to provide more than one
piece of identifying information. Push notifications,
authenticator apps, SMS, and DUO Security are supported.
</p>
</div>
</div>
<div class="row">
<div class="col-md-5 mb-4">
<h6 class="mb-3">
<a href="https://auth0.com/docs/anomaly-detection">
<i class="fas fa-link"></i> Anomaly Detection
</a>
</h6>
<p>
Auth0 can detect anomalies and stop malicious attempts to
access your application. Anomaly detection can alert you and
your users of suspicious activity, as well as block further
login attempts.
</p>
</div>
<div class="col-md"></div>
<div class="col-md-5 mb-4">
<h6 class="mb-3">
<a href="https://auth0.com/docs/rules">
<i class="fas fa-link"></i> Learn About Rules
</a>
</h6>
<p>
Rules are JavaScript functions that execute when a user
authenticates to your application. They run once the
authentication process is complete, and you can use them to
customize and extend Auth0's capabilities.
</p>
</div>
</div>
</div>
</div>
<div class="page" id="content-profile">
<div class="container">
<div class="row align-items-center profile-header">
<div class="col-md-2">
<img
alt="User's profile picture"
class="rounded-circle img-fluid profile-image mb-3 mb-md-0"
/>
</div>
<div class="col-md">
<h2 class="user-name"></h2>
<p class="lead text-muted user-email"></p>
</div>
</div>
<div class="row">
<pre class="rounded">
<code id="profile-data" class="json"></code></pre>
</div>
</div>
</div>
<div class="page" id="content-external-api">
<h1>External API</h1>
<p>
Ping an external API by clicking the button below. This will call
the external API using an access token, and the API will validate it
using the API's audience value.
</p>
<p class="mb-5">
<a href="#" class="btn btn-primary mt-5" id="call-api">Ping API</a>
</p>
<div class="result-block-container">
<div class="result-block reset-on-nav">
<h6 class="muted">Result</h6>
<pre>
<code class="js rounded" id="api-call-result">JSON.stringify(apiMessage, null, 2)</code>
</pre>
</div>
</div>
</div>
</div>
<footer class="bg-light text-center p-5">
<div class="logo"></div>
<p>
Sample project provided by
<a href="https://auth0.com">Auth0</a>
</p>
</footer>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.auth0.com/js/auth0-spa-js/1.13/auth0-spa-js.production.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js"></script>
<script src="js/ui.js"></script>
<script src="js/app.js"></script>
</body>
</html>