Skip to content

Commit bf76378

Browse files
committed
fix: logout in case no logout url in identity provider
1 parent cacbee6 commit bf76378

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

api/src/core/usecases/auth/logout.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export const makeInitiateLogout =
2424
throw new Error(`Session not found: ${sessionId}`);
2525
}
2626

27-
// Mark session as logged out immediately
2827
await sessionRepository.update({ ...session, loggedOutAt: new Date() });
2928

3029
// Get logout URL from OIDC client

api/src/core/usecases/auth/oidcClient.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,14 @@ export class HttpOidcClient implements OidcClient {
123123

124124
const userInfoAsString = responseBody.startsWith("ey") ? atob(responseBody.split(".")[1]) : responseBody;
125125

126+
console.log("\n \n userInfoAsString : ", userInfoAsString);
127+
126128
return JSON.parse(userInfoAsString);
127129
}
128130

129131
async logout(idToken: string | null): Promise<string> {
130132
if (!this.#config.end_session_endpoint) {
131-
throw new Error("OIDC provider does not support logout");
133+
return this.logoutRedirectUri; // in that case we skip the logout and redirect to the identity provider logout page
132134
}
133135

134136
const logoutUrl = new URL(this.#config.end_session_endpoint);

0 commit comments

Comments
 (0)