-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google Auth Redirection Not Working (Netlify & AWS) #2344
Comments
Additionally, when I try to directly enter https://myapp.netlify.app/oauth/callback, it gives the Netlify “page not exist” error page. When I enter http://localhost:3000/oauth/callback in the local dev environment, however, it brings me to the ai demo app page (if I signed in) or to a error page still with the web app’s nav bar (if I did not sign in) This leads me to hypothesize that the front end code might just be built incorrectly. Does this auth/callback URL correspond to a webhook or a file? (I am new to this so sorry in advance for the dumb question) Any suggestions on how to debug it? |
Hmm tired to run the built version for front end locally and http://localhost:3000/oauth/callback also brings me to the app or the error page. Seems like there is something wrong with either the router or building the oauth callback page. This bug is quite mysterious so far, not sure what could have gone wrong. Any advice is appreciated! |
I asked the question on Discord and got a solution: I was originally building the app on push not through the Netlify CLI's terminal command, but through linking Netlify with the Git Repo and using a hacky deploy command through their web interface on each Git push:
For some reason, this does NOT build the The issue is fixed when I switched to using the Netlify CLI's terminal command in Github Actions to deploy. Here is my Github Action file for deploying frontend, people may find this useful: Github Action
|
The original issue is closed but I think it would make sense in the Docs to explicitly mention to NOT deploy through the Netlify auto deploy on push option on the Netlify website, which seems very tempting since it is a lot less work than typing up a Github Action yml file. This is generally the default option for most people building site there). I originally encountered this issue yesterday at 3pm (that's when I asked in Discord) and the issue is solved at 3am today. Now when I look back, a small update in the Docs would really save me a lot of time. Especially because I originally thought it was a backend network issue in the AWS EC2 instance (there's no documentation on deploying via AWS) and completely overengineered my nginx setting 😅 If possible, I would like to update the docs myself - I think this project is really cool and am excited to contribute to it! However, I'm not sure if this issue only applies to projects built upon the Open Saas template, or whether it applies to all Wasp projects in general. If I am to update the docs, should I update the docs for the Open Saas project or just for Wasp? |
I answered in more details here: https://discord.com/channels/686873244791210014/1296568113692938272/1296926685735817308 ! |
Describe the bug
I am currently trying to deploy an app built with Open-Saas on Netlify and AWS EC2 instance with Nginx. Everything was working in the developer environment, but when I try logging in via Google it breaks. The Google Auth screen shows up normally and gives a response that results in several redirects, but after signing in it eventually redirects to https://myapp.netlify.app/oauth/callback, where it is met with a 404 (the same redirection returns a 304 in local developing environment). I have posted the screenshots from Google Dev console. At the time of failure, the url showing up in chrome is https://myapp.netlify.app/oauth/callback#{long_token}
To Reproduce
Use the Open Saas Template to deploy a project frontend on Netlify and Docker container on an AWS EC2 instance with Nginx using Google Auth. The Http requests will break due to Netlify's security policy (Https requests will also be banned if you use a self-generated certificate), so add a custom domain name and use openssl to generate a trusted certificate and host a redirect on CloudFront.
Signing in via Google Auth will result in an error. In partilcular, it will result in a Netlify's "This page does not exist" error.
Expected behavior
Signing in via Google Auth results in a website error page / redirects to the example ai app.
Screenshots
Here is the error page I got:
Here is the expected error page (Ideally it should sign me in and go to the app but even if Google Auth fails we should see this error instead of the previous one):
Here are the two redirect requests being met with different responses:
Desktop (please complete the following information):
Additional context
I went though the docs and previous questions but was not able to find much helpful information. I imagine it has something to do with the netlify.toml file but am not sure what to change. Please let me know if there are any other information I can provide. Any suggestion would be much appreciated!
The text was updated successfully, but these errors were encountered: