Angular 6 authorization code flow - user_info endpoint
I am trying to implement authorization code flow from Angular 6 application hosted in IIS. Library versions -> "oidc-client": "^1.6.0", "babel-polyfill": "^6.23.0".
After IDP login is successful, token endpoint is called and I see http response 200. But it doesn't make user_info endpoint call. Token endpoint call was the last one and it stops there.
Console shows these errors:
- Access to XMLHttpRequest at 'https://exampleidp/oidc/token' from origin 'https://examplespa.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
- Access to XMLHttpRequest at 'https://myexampleidp.com/oidc/token' from origin 'https://mySPA.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
- signinRedirectCallback function call errors out with this error -> Error: Network Error.
This is my UserManagerSettings object: { authority: 'exampleidpurl', client_id: 'exampleclientid', client_secret: 'examplesecret', redirect_uri: 'examplespaurl', post_logout_redirect_uri: 'examplelogouturl', response_type: 'code', scope: 'openid', filterProtocolClaims: true, loadUserInfo: true, metadata: { issuer: 'exampleidpurl', authorization_endpoint: 'exampleauthurl', token_endpoint: 'exampletokenurl', userinfo_endpoint: 'exampleuserurl', end_session_endpoint: 'examplesessionurl', jwks_uri: 'examplejwksurl' }
Based on this reference https://www.chromium.org/Home/chromium-security/corb-for-developers , I thought item #2 can be ignored. I tried to fix item #1 by adding http response headers (access-control-allow-origin), still the result is same. I have tried adding events (addUserLoaded, etc) but they don't fire as it stops after receiving response from token endpoint.
Anyone faced this kind of issue? Any suggestions will be of much help. Thanks.
Not sure why in your scenario there's no call to user info -- did you disable that setting in the callback page's options, perhaps?
Any update?
Hi @jchandramohan,
How did you solve this? I'm facing the same issue.
thanks