I'm using release version of 8.0.4 in my angular 8 project with authorization code flow:
here is the code I have
this.oauthService.configure(authConfig);
this.oauthService.tokenValidationHandler = new JwksValidationHandler();
this.oauthService
.loadDiscoveryDocument()
.then(() => this.oauthService.tryLogin()) ---> [1]
.then(() => {
if (this.oauthService.hasValidAccessToken()) {
return Promise.resolve();
}else{
this.oauthService.initCodeFlow() ---> [2]
}
});
}
Initially when user is not logged in the code at [2] redirects user to login page.
Once user provides username/password and click login, the identity provider redirects back to app with "code" in querystring, that is when I'm expecting code at [1] to login the user with code (by redeeming it for tokens).
Instead the tryLogin() method doesn't work and the user is again redirected to authorzation endpoint in endless loop.
Please help me understand, what is going wrong here.
also, does this example : https://github.com/jeroenheijmans/sample-angular-oauth2-oidc-with-auth-guards/ apply for version 8 ?