I have an Angular application, a gateway, and a service. The Angular app makes calls to the service via the gateway, which uses Spring Security 6. When the user is not authenticated, a 401 Unauthorized status code is returned. The Angular app intercepts this and starts the OAuth flow in the browser
This authenticates the user through the browser in the gateway using Single Sign-On (SSO) with ADFS. After authentication, the browser redirects to http://localhost:8080/, which results in a 404 Not Found error because there is no endpoint at that URL.
I want to relaunch the Angular SPA after the user has been authenticated through the browser or have the gateway memorize the initial call and call it when authentication is done ( or any other solution that would allow for the browser to authenticate the user and then return to the SPA). Is there any way to achieve this?
Additional Information:
I am using the authorization code flow with the gateway as the OAuth client.
The SPA itself is not the OAuth client, so I want to avoid using OAuth Angular libraries.
when the 401 Unauthorized status code is returned, I Call the below line in the interceptor :
window.location.href = ‘http://localhost:8080/oauth2/authorization/adfs’;
but i get redirected to the :
‘http://localhost:8080/’ instead of the ‘http://localhost:4200/’ – for the SPA
Debrah Tinsia is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.