-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo.html
33 lines (26 loc) · 1.15 KB
/
demo.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
<link rel="stylesheet" href="https://unpkg.com/[email protected]/mvp.css">
<div style="display: flex; height: 100vh; align-items: center; justify-content: center; flex-direction: column;">
<button onclick="onClickRequest()">Request Profile</button>
<button onclick="onClickSignIn()">Sign In</button>
<button onclick="onClickSignOut()">Sign Out</button>
<pre><code id="output"></code></pre>
</div>
<script type="module">
import passwordless from './src/index.js'
async function init() {
const user = await passwordless.id({scope:'openid avatar email'})
document.getElementById('output').textContent = JSON.stringify(user, null,' ')
}
init()
window.onClickSignIn = () => {
passwordless.auth({scope:'openid avatar email'})
}
window.onClickRequest = async () => {
const user = await passwordless.request({scope:'openid avatar email'})
document.getElementById('output').textContent = JSON.stringify(user, null,' ')
}
window.onClickSignOut = async () => {
const user = await passwordless.logout()
document.getElementById('output').textContent = ''
}
</script>