mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-24 12:04:57 +01:00
Fix logout not revoking oidc access token
This commit is contained in:
parent
e09d66a57e
commit
35dbb5a59a
@ -481,25 +481,30 @@ export class Client {
|
|||||||
throw new Error(`Could not find session for id ${this._sessionId}`);
|
throw new Error(`Could not find session for id ${this._sessionId}`);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const hsApi = new HomeServerApi({
|
if (sessionInfo.oidcIssuer) {
|
||||||
homeserver: sessionInfo.homeServer,
|
const oidcApi = new OidcApi({
|
||||||
accessToken: sessionInfo.accessToken,
|
issuer: sessionInfo.oidcIssuer,
|
||||||
request: this._platform.request
|
clientConfigs: this._platform.config.oidc.clientConfigs,
|
||||||
});
|
clientId: sessionInfo.oidcClientId,
|
||||||
await hsApi.logout({log}).response();
|
request: this._platform.request,
|
||||||
const oidcApi = new OidcApi({
|
encoding: this._platform.encoding,
|
||||||
issuer: sessionInfo.oidcIssuer,
|
crypto: this._platform.crypto,
|
||||||
clientConfigs: this._platform.config.oidc.clientConfigs,
|
});
|
||||||
clientId: sessionInfo.oidcClientId,
|
await oidcApi.revokeToken({ token: sessionInfo.accessToken, type: "access" });
|
||||||
request: this._platform.request,
|
if (sessionInfo.refreshToken) {
|
||||||
encoding: this._platform.encoding,
|
await oidcApi.revokeToken({ token: sessionInfo.refreshToken, type: "refresh" });
|
||||||
crypto: this._platform.crypto,
|
}
|
||||||
});
|
} else {
|
||||||
await oidcApi.revokeToken({ token: sessionInfo.accessToken, type: "access" });
|
const hsApi = new HomeServerApi({
|
||||||
if (sessionInfo.refreshToken) {
|
homeserver: sessionInfo.homeServer,
|
||||||
await oidcApi.revokeToken({ token: sessionInfo.refreshToken, type: "refresh" });
|
accessToken: sessionInfo.accessToken,
|
||||||
|
request: this._platform.request
|
||||||
|
});
|
||||||
|
await hsApi.logout({log}).response();
|
||||||
}
|
}
|
||||||
} catch (err) {}
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
}
|
||||||
await this.deleteSession(log);
|
await this.deleteSession(log);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user