Skip to content

Commit 2945427

Browse files
rubensworksRubenVerborgh
authored andcommitted
Fix logout not removing session from RP
The root cause of the problem is that @solid/oidc-rp logs out from the IDP, but not from the RP. This fix adds a call to the well-known logout URL from Solid. Closes nodeSolidServer/oidc-rp#21
1 parent ee07382 commit 2945427

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/webid-oidc.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @flow
2-
/* global RequestInfo, Response */
2+
/* global RequestInfo, Response, fetch */
33
import * as authorization from 'auth-header'
44
import RelyingParty from '@solid/oidc-rp'
55
import PoPToken from '@solid/oidc-rp/lib/PoPToken'
@@ -59,7 +59,14 @@ export async function logout(storage: AsyncStorage): Promise<void> {
5959
const rp = await getStoredRp(storage)
6060
if (rp) {
6161
try {
62-
rp.logout()
62+
// First log out from the IDP
63+
await rp.logout()
64+
// Then, log out from the RP
65+
try {
66+
await fetch('/.well-known/solid/logout', { credentials: 'include' })
67+
} catch (e) {
68+
// Ignore errors for when we are not on a Solid pod
69+
}
6370
} catch (err) {
6471
console.warn('Error logging out of the WebID-OIDC session')
6572
console.error(err)

0 commit comments

Comments
 (0)