Skip to content

Commit 25ca5c6

Browse files
Merge pull request manfredsteyer#397 from mpbalmeida/master
Use responseType parameter
2 parents b99c2c3 + 24c3c90 commit 25ca5c6

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

projects/lib/src/oauth-service.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,14 @@ export class OAuthService extends AuthConfig {
333333

334334
/**
335335
* DEPRECATED. Use a provider for OAuthStorage instead:
336-
*
336+
*
337337
* { provide: OAuthStorage, useValue: localStorage }
338-
*
338+
*
339339
* Sets a custom storage used to store the received
340340
* tokens on client side. By default, the browser's
341341
* sessionStorage is used.
342342
* @ignore
343-
*
343+
*
344344
* @param storage
345345
*/
346346
public setStorage(storage: OAuthStorage): void {
@@ -847,7 +847,7 @@ export class OAuthService extends AuthConfig {
847847
const redirectUri = this.silentRefreshRedirectUri || this.redirectUri;
848848
this.createLoginUrl(null, null, redirectUri, noPrompt, params).then(url => {
849849
iframe.setAttribute('src', url);
850-
850+
851851
if (!this.silentRefreshShowIFrame) {
852852
iframe.style['display'] = 'none';
853853
}
@@ -1085,12 +1085,16 @@ export class OAuthService extends AuthConfig {
10851085
);
10861086
}
10871087

1088-
if (this.oidc && this.requestAccessToken) {
1089-
this.responseType = 'id_token token';
1090-
} else if (this.oidc && !this.requestAccessToken) {
1091-
this.responseType = 'id_token';
1088+
if (this.config.responseType) {
1089+
this.responseType = this.config.responseType;
10921090
} else {
1093-
this.responseType = 'token';
1091+
if (this.oidc && this.requestAccessToken) {
1092+
this.responseType = 'id_token token';
1093+
} else if (this.oidc && !this.requestAccessToken) {
1094+
this.responseType = 'id_token';
1095+
} else {
1096+
this.responseType = 'token';
1097+
}
10941098
}
10951099

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

0 commit comments

Comments
 (0)