Skip to content

Commit

Permalink
Merge pull request #1681 from dopry/fix/2.4.x-signoutCallback-does-no…
Browse files Browse the repository at this point in the history
…t-return-state

fix: return signout response from signoutCallback
  • Loading branch information
pamapa authored Oct 3, 2024
2 parents 5de05ea + b579396 commit d94be14
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 @@ -967,7 +967,7 @@ export class UserManager {
// (undocumented)
protected _signout(args: CreateSignoutRequestArgs, handle: IWindow): Promise<SignoutResponse>;
// (undocumented)
signoutCallback(url?: string, keepOpen?: boolean): Promise<void>;
signoutCallback(url?: string, keepOpen?: boolean): Promise<SignoutResponse | void>;
// (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 @@ -332,16 +332,15 @@ export class UserManager {
}
}

public async signoutCallback(url = window.location.href, keepOpen = false): Promise<void> {
public async signoutCallback(url = window.location.href, keepOpen = false): Promise<SignoutResponse | void> {
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 @@ -351,6 +350,7 @@ export class UserManager {
default:
throw new Error("invalid response_type in state");
}
return undefined;
}

/**
Expand Down

0 comments on commit d94be14

Please sign in to comment.