0
votes

I'm trying to integrate oAuth2 oidc login in the Angular App. Here I'm facing an issue when I call authorize endpoint to get the authorization code, the page is redirecting to the new location where code gets refreshed and appears on URL. Now I'm unable to read that code from URL and continue with next steps to get token and do successful login.

step1: Calls below sample end point

location.href = https://ww.abc.com/authorize?client_id=abc123&response_type=code&scope=openid profile

step2: redirects to new location which has authorization _code

https://ww.xyz.com/myApp?code=abc123qwe

step3: Unable to execute next piece of code that fetchs code from url.

window.location.search.startsWith('?code=')

Would be very thankful if someone could help me with this.

1

1 Answers

0
votes

I had a similar issue when hosting an SPA in AWS via S3 and Cloudfront. The response was received as 'spa?code=xxx', causing a redirect to 'spa/', losing the authorization code.

My resolution was just to ensure that the registered redirect URI had a trailing / character. Will that work for you?