Skip to content

Commit 439e521

Browse files
committed
Fixed the issue when logout URL has a parameter
When the logout URL has a parameter, the URL was constructed incorrectly, first parameter would be added with a "?" instead of a "&", which resulted in an URL with two "?" which is invalid. Corrected by checking if the URL already contains a "?", and if it does, add the first parameter with a "&" instead of a "?". Fixes #134
1 parent e28e14b commit 439e521

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

angular-oauth2-oidc/src/oauth-service.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -1412,10 +1412,12 @@ export class OAuthService
14121412
logoutUrl = this.logoutUrl.replace(/\{\{id_token\}\}/, id_token);
14131413
}
14141414
else {
1415-
logoutUrl = this.logoutUrl + '?id_token_hint='
1416-
+ encodeURIComponent(id_token)
1417-
+ '&post_logout_redirect_uri='
1418-
+ encodeURIComponent(this.postLogoutRedirectUri || this.redirectUri);
1415+
logoutUrl = this.logoutUrl +
1416+
(this.logoutUrl.indexOf('?') > -1 ? '&' : '?')
1417+
+ 'id_token_hint='
1418+
+ encodeURIComponent(id_token)
1419+
+ '&post_logout_redirect_uri='
1420+
+ encodeURIComponent(this.postLogoutRedirectUri || this.redirectUri);
14191421
}
14201422
location.href = logoutUrl;
14211423
};

0 commit comments

Comments
 (0)