Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make signoutCallback return signout response if request_type is so:r #1672

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/oidc-client-ts.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ export class UserManager {
protected _signinStart(args: CreateSigninRequestArgs, handle: IWindow): Promise<NavigateResponse>;
// (undocumented)
protected _signout(args: CreateSignoutRequestArgs, handle: IWindow): Promise<SignoutResponse>;
signoutCallback(url?: string, keepOpen?: boolean): Promise<void>;
signoutCallback(url?: string, keepOpen?: boolean): Promise<SignoutResponse | undefined>;
// (undocumented)
protected _signoutEnd(url: string): Promise<SignoutResponse>;
signoutPopup(args?: SignoutPopupArgs): Promise<void>;
Expand Down
8 changes: 4 additions & 4 deletions src/UserManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,16 +418,15 @@ export class UserManager {
*
* @throws `Error` If request_type is unknown or signout cannot be processed.
*/
public async signoutCallback(url = window.location.href, keepOpen = false): Promise<void> {
public async signoutCallback(url = window.location.href, keepOpen = false): Promise<SignoutResponse | undefined> {
const { state } = await this._client.readSignoutResponseState(url);
if (!state) {
return;
return undefined;
}

switch (state.request_type) {
case "so:r":
await this.signoutRedirectCallback(url);
break;
return await this.signoutRedirectCallback(url);
case "so:p":
await this.signoutPopupCallback(url, keepOpen);
break;
Expand All @@ -437,6 +436,7 @@ export class UserManager {
default:
throw new Error("invalid response_type in state");
}
return undefined;
}

/**
Expand Down
Loading