Skip to content

Commit 24c3c90

Browse files
committed
Use responseType parameter
Check user requestType paramater before apply default responseType. So the user can define the behavior. Closes: manfredsteyer#385 See: manfredsteyer#385
1 parent b4c8731 commit 24c3c90

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

projects/lib/src/oauth-service.ts

+13-9
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,14 @@ export class OAuthService extends AuthConfig {
331331

332332
/**
333333
* DEPRECATED. Use a provider for OAuthStorage instead:
334-
*
334+
*
335335
* { provide: OAuthStorage, useValue: localStorage }
336-
*
336+
*
337337
* Sets a custom storage used to store the received
338338
* tokens on client side. By default, the browser's
339339
* sessionStorage is used.
340340
* @ignore
341-
*
341+
*
342342
* @param storage
343343
*/
344344
public setStorage(storage: OAuthStorage): void {
@@ -845,7 +845,7 @@ export class OAuthService extends AuthConfig {
845845
const redirectUri = this.silentRefreshRedirectUri || this.redirectUri;
846846
this.createLoginUrl(null, null, redirectUri, noPrompt, params).then(url => {
847847
iframe.setAttribute('src', url);
848-
848+
849849
if (!this.silentRefreshShowIFrame) {
850850
iframe.style['display'] = 'none';
851851
}
@@ -1083,12 +1083,16 @@ export class OAuthService extends AuthConfig {
10831083
);
10841084
}
10851085

1086-
if (this.oidc && this.requestAccessToken) {
1087-
this.responseType = 'id_token token';
1088-
} else if (this.oidc && !this.requestAccessToken) {
1089-
this.responseType = 'id_token';
1086+
if (this.config.responseType) {
1087+
this.responseType = this.config.responseType;
10901088
} else {
1091-
this.responseType = 'token';
1089+
if (this.oidc && this.requestAccessToken) {
1090+
this.responseType = 'id_token token';
1091+
} else if (this.oidc && !this.requestAccessToken) {
1092+
this.responseType = 'id_token';
1093+
} else {
1094+
this.responseType = 'token';
1095+
}
10921096
}
10931097

10941098
const seperationChar = that.loginUrl.indexOf('?') > -1 ? '&' : '?';

0 commit comments

Comments
 (0)