After integrating the Angular-oauth2-oidc library in our application, we got the following error message when invoking the Implicit Flow:
Error validating tokens. Wrong nonce.
This is the code we were using:
Problem is that the loadDiscoveryDocument is a promise and we didn’t await for the result. As a consequence the nonce from the first request(loadDiscoveryDocumentAndTryLogin) is overwritten by the second request(initImplicitFlow) causing the error above.
To fix it we have to chain the requests together: