|
1 | 1 | <script> |
2 | | - import { browser } from '$app/environment'; |
3 | 2 | import { |
4 | 3 | EventLog, |
5 | 4 | LoginButton, |
6 | 5 | LogoutButton, |
7 | | - OidcContext, |
8 | 6 | RefreshTokenButton, |
9 | 7 | accessToken, |
10 | 8 | authError, |
|
13 | 11 | isLoading, |
14 | 12 | userInfo |
15 | 13 | } from '@dopry/svelte-oidc'; |
16 | | -
|
17 | | - const metadata = {}; |
18 | 14 | </script> |
19 | 15 |
|
20 | | -{#if browser} |
21 | | - <OidcContext |
22 | | - issuer="http://localhost:8000/o" |
23 | | - client_id="2EIxgjlyy5VgCp2fjhEpKLyRtSMMPK0hZ0gBpNdm" |
24 | | - redirect_uri="http://localhost:5173" |
25 | | - post_logout_redirect_uri="http://localhost:5173" |
26 | | - {metadata} |
27 | | - scope="openid" |
28 | | - extraOptions={{ |
29 | | - mergeClaims: true |
30 | | - }} |
31 | | - > |
32 | | - <div class="row"> |
33 | | - <div class="col s12"> |
34 | | - <LoginButton>Login</LoginButton> |
35 | | - <LogoutButton>Logout</LogoutButton> |
36 | | - <RefreshTokenButton>refreshToken</RefreshTokenButton> |
37 | | - </div> |
38 | | - </div> |
39 | | - <div class="row"> |
40 | | - <div class="col s12"> |
41 | | - <table> |
42 | | - <thead> |
43 | | - <tr><th>isLoading</th><th>isAuthenticated</th><th>authError</th></tr> |
44 | | - </thead> |
45 | | - <tbody> |
46 | | - <tr> |
47 | | - <td>{$isLoading}</td> |
48 | | - <td>{$isAuthenticated}</td> |
49 | | - <td>{$authError || 'None'}</td> |
50 | | - </tr> |
51 | | - </tbody> |
52 | | - </table> |
53 | | - </div> |
54 | | - </div> |
55 | | - <div class="row"> |
56 | | - <div class="col s12"> |
57 | | - <table> |
58 | | - <thead> |
59 | | - <tr><th style="width: 20%;">store</th><th style="width: 80%;">value</th></tr |
60 | | - > |
61 | | - </thead> |
62 | | - <tbody> |
63 | | - <tr |
64 | | - ><td>userInfo</td><td |
65 | | - ><pre>{JSON.stringify($userInfo, null, 2) || ''}</pre></td |
66 | | - ></tr |
67 | | - > |
68 | | - <tr |
69 | | - ><td>accessToken</td><td style="word-break: break-all;" |
70 | | - >{$accessToken}</td |
71 | | - ></tr |
72 | | - > |
73 | | - <tr><td>idToken</td><td style="word-break: break-all;">{$idToken}</td></tr> |
74 | | - </tbody> |
75 | | - </table> |
76 | | - </div> |
77 | | - </div> |
78 | | - <div class="row"> |
79 | | - <div class="col s12"> |
80 | | - <EventLog /> |
81 | | - </div> |
82 | | - </div> |
83 | | - </OidcContext> |
84 | | -{/if} |
| 16 | +<div class="row"> |
| 17 | + <div class="col s12"> |
| 18 | + <LoginButton>Login</LoginButton> |
| 19 | + <LogoutButton>Logout</LogoutButton> |
| 20 | + <RefreshTokenButton>refreshToken</RefreshTokenButton> |
| 21 | + </div> |
| 22 | +</div> |
| 23 | +<div class="row"> |
| 24 | + <div class="col s12"> |
| 25 | + <table> |
| 26 | + <thead> |
| 27 | + <tr><th>isLoading</th><th>isAuthenticated</th><th>authError</th></tr> |
| 28 | + </thead> |
| 29 | + <tbody> |
| 30 | + <tr> |
| 31 | + <td>{$isLoading}</td> |
| 32 | + <td>{$isAuthenticated}</td> |
| 33 | + <td>{$authError || 'None'}</td> |
| 34 | + </tr> |
| 35 | + </tbody> |
| 36 | + </table> |
| 37 | + </div> |
| 38 | +</div> |
| 39 | +<div class="row"> |
| 40 | + <div class="col s12"> |
| 41 | + <table> |
| 42 | + <thead> |
| 43 | + <tr><th style="width: 20%;">store</th><th style="width: 80%;">value</th></tr> |
| 44 | + </thead> |
| 45 | + <tbody> |
| 46 | + <tr |
| 47 | + ><td>userInfo</td><td><pre>{JSON.stringify($userInfo, null, 2) || ''}</pre></td></tr |
| 48 | + > |
| 49 | + <tr |
| 50 | + ><td>accessToken</td><td style="word-break: break-all;">{$accessToken}</td></tr |
| 51 | + > |
| 52 | + <tr><td>idToken</td><td style="word-break: break-all;">{$idToken}</td></tr> |
| 53 | + </tbody> |
| 54 | + </table> |
| 55 | + </div> |
| 56 | +</div> |
| 57 | +<div class="row"> |
| 58 | + <div class="col s12"> |
| 59 | + <EventLog /> |
| 60 | + </div> |
| 61 | +</div> |
0 commit comments