Skip to content

Commit

Permalink
Merge pull request #1672 from peetck/main
Browse files Browse the repository at this point in the history
make signoutCallback return signout response if request_type is so:r
  • Loading branch information
pamapa authored Sep 20, 2024
2 parents df9dbfc + 861d603 commit e04c828
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit e04c828

Please sign in to comment.