Skip to content

Commit ad4b7a1

Browse files
authored
Merge pull request #239 from nipunsampath/fix-redirect-uri-signout-request
2 parents f8ed951 + 5f855f2 commit ad4b7a1

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/src/core/authentication-core.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,9 @@ export class AuthenticationCore<T> {
556556
"No sign-in redirect URL has been found either. "
557557
);
558558
}
559+
const queryParams: URLSearchParams = new URLSearchParams();
559560

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

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

575-
const logoutCallback: string =
576-
`${ logoutEndpoint }?` +
577-
parameter +
578-
`&post_logout_redirect_uri=${ callbackURL }&state=` +
579-
SIGN_OUT_SUCCESS_PARAM;
578+
queryParams.set("state", SIGN_OUT_SUCCESS_PARAM);
580579

581-
return logoutCallback;
580+
return `${logoutEndpoint}?${queryParams.toString()}`;
582581
}
583582

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

0 commit comments

Comments
 (0)