Skip to content

Commit 37129f4

Browse files
manfredsteyer#739: Add optional state parameter for logout
1 parent 41a6ea0 commit 37129f4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

projects/lib/src/oauth-service.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -2095,10 +2095,11 @@ export class OAuthService extends AuthConfig implements OnDestroy {
20952095
/**
20962096
* Removes all tokens and logs the user out.
20972097
* If a logout url is configured, the user is
2098-
* redirected to it.
2098+
* redirected to it with optional state parameter.
20992099
* @param noRedirectToLogoutUrl
2100+
* @param state
21002101
*/
2101-
public logOut(noRedirectToLogoutUrl = false): void {
2102+
public logOut(noRedirectToLogoutUrl = false, state = ''): void {
21022103
const id_token = this.getIdToken();
21032104
this._storage.removeItem('access_token');
21042105
this._storage.removeItem('id_token');
@@ -2151,6 +2152,10 @@ export class OAuthService extends AuthConfig implements OnDestroy {
21512152
const postLogoutUrl = this.postLogoutRedirectUri || this.redirectUri;
21522153
if (postLogoutUrl) {
21532154
params = params.set('post_logout_redirect_uri', postLogoutUrl);
2155+
2156+
if (state) {
2157+
params = params.set('state', state);
2158+
}
21542159
}
21552160

21562161
logoutUrl =

0 commit comments

Comments
 (0)