Skip to content

Commit 132c624

Browse files
authored
fix: loadDiscoveryDocumentAndLogin should pass state into initLoginFlow
Currently in loadDiscoveryDocumentAndLogin the state parameter is not used at all. It should be passed into initLoginFlow in order for it to be serialized in the login redirection.
1 parent c587f55 commit 132c624

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

projects/lib/src/oauth-service.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,11 @@ export class OAuthService extends AuthConfig implements OnDestroy {
275275
public loadDiscoveryDocumentAndLogin(
276276
options: LoginOptions & { state?: string } = null
277277
): Promise<boolean> {
278-
if (!options) {
279-
options = { state: '' };
280-
}
278+
options = options || {};
281279
return this.loadDiscoveryDocumentAndTryLogin(options).then(_ => {
282280
if (!this.hasValidIdToken() || !this.hasValidAccessToken()) {
283-
if (this.responseType === 'code') {
284-
this.initCodeFlow();
285-
} else {
286-
this.initImplicitFlow();
287-
}
281+
const state = typeof options.state === 'string' ? options.state : '';
282+
this.initLoginFlow(state);
288283
return false;
289284
} else {
290285
return true;

0 commit comments

Comments
 (0)