Skip to content

Commit

Permalink
Merge pull request #239 from nipunsampath/fix-redirect-uri-signout-re…
Browse files Browse the repository at this point in the history
…quest
  • Loading branch information
nipunsampath authored Nov 6, 2023
2 parents f8ed951 + 5f855f2 commit ad4b7a1
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/src/core/authentication-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,9 @@ export class AuthenticationCore<T> {
"No sign-in redirect URL has been found either. "
);
}
const queryParams: URLSearchParams = new URLSearchParams();

let parameter: string = `client_id=${ configData.clientID }`;
queryParams.set("post_logout_redirect_uri", callbackURL);

if (configData.sendIdTokenInLogoutRequest) {
const idToken: string = (await this._dataLayer.getSessionData(userID))?.id_token;
Expand All @@ -569,16 +570,14 @@ export class AuthenticationCore<T> {
"No ID token could be found. Either the session information is lost or you have not signed in."
);
}
parameter = `id_token_hint=${ idToken }`;
queryParams.set("id_token_hint", idToken);
} else {
queryParams.set("client_id", configData.clientID);
}

const logoutCallback: string =
`${ logoutEndpoint }?` +
parameter +
`&post_logout_redirect_uri=${ callbackURL }&state=` +
SIGN_OUT_SUCCESS_PARAM;
queryParams.set("state", SIGN_OUT_SUCCESS_PARAM);

return logoutCallback;
return `${logoutEndpoint}?${queryParams.toString()}`;
}

public async clearUserSessionData(userID?: string): Promise<void> {
Expand Down

0 comments on commit ad4b7a1

Please sign in to comment.