Skip to main content

Posts

Showing posts from 2018

oAuth2 404 Error on Redirect - Google and an Angular2 app

Issue Encountered: Could never properly redirect back to our Angular2 application after successful social based authentication. We were encountering a 404 (file not found) redirect issue in an Angular2 app after successfully authenticating via Google oAuth login.  I was running my Angular application on Tomcat 9 and had the app running under an application context and not in the root (default-context> of the server.  For example /example-application/index.html.  The problem was the oAuth callback success url was set to /example-application/social-login-success?token= and you would just always get back a 404 error because the application/web server (Tomcat) was not able to retrieve a file at that location.  That url is actually an Angular route that the angular router needs to handle, but the router was never being reached. Solution:   Add a redirect at the tomcat level.     1) Create a WEB-INF folder at location of your application root <Tomcat-root>/<example-app