mirror of
https://github.com/TECHNOFAB11/svelte-oidc.git
synced 2025-12-11 23:50:06 +01:00
...
This commit is contained in:
parent
7a1b1f6af0
commit
2cc87c0b95
1 changed files with 154 additions and 172 deletions
|
|
@ -77,24 +77,7 @@
|
|||
const oidc = await oidcPromise;
|
||||
const returnTo = logout_url || window.location.href;
|
||||
oidc.signoutRedirect({ returnTo });
|
||||
try {
|
||||
const response = await oidc.signoutRedirect({ returnTo });
|
||||
} catch (err) {
|
||||
if (err.message !== 'no end session endpoint') throw err;
|
||||
// this is most likely auth0, so let's try their logout endpoint.
|
||||
// @see: https://auth0.com/docs/api/authentication#logout
|
||||
// this is dirty and hack and reaches into guts of the oidc client
|
||||
// in ways I'd prefer not to.. but auth0 has this annoying non-conforming
|
||||
// session termination.
|
||||
const authority = oidc._settings._authority;
|
||||
if (authority.endsWith('auth0.com')) {
|
||||
const clientId = oidc._settings._client_id;
|
||||
const url = `${authority}/v2/logout?client_id=${clientId}&returnTo=${encodeURIComponent(
|
||||
returnTo
|
||||
)}`;
|
||||
window.location = url;
|
||||
} else throw err
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -128,6 +111,7 @@
|
|||
accessToken.set(user.access_token);
|
||||
idToken.set(user.id_token);
|
||||
userInfo.set(user.profile);
|
||||
isLoading.set(false);
|
||||
});
|
||||
|
||||
userManager.events.addUserUnloaded(function() {
|
||||
|
|
@ -186,9 +170,7 @@
|
|||
// what the uris loook like. I fear this may be problematic in other auth flows in the future.
|
||||
else if (params.has('state')) {
|
||||
const response = await oidc.signinCallback();
|
||||
console.log('oidc.signinCallback::response', response)
|
||||
}
|
||||
isLoading.set(false);
|
||||
}
|
||||
async function handleOnDestroy() {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue