forked from inrupt/solid-client-authn-js
-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
29 lines (29 loc) · 918 Bytes
/
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
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
<script src="./solid-auth-fetcher.bundle.js">
</script>
<script>
const TEST_URL = 'https://michielbdejong.solidcommunity.net/private/';
async function go() {
const authFetcher = await solidAuthFetcher.customAuthFetcher();
const result = await solidAuthFetcher.fetch(TEST_URL);
document.write(`${result.status}<br>`);
if (result.status === 401) {
document.write('Logging in!<br>');
const session = await authFetcher.login({
oidcIssuer: new URL(TEST_URL).origin,
redirect: location.href
});
// FIXME: avoid this hard-coded timeout
// Without this you end up at http://localhost:5000/undefined
await new Promise(resolve => setTimeout(resolve, 5000));
window.location = session.neededAction.redirectUrl;
}
}
go()
</script>
</html>