Google Auth Redirection Not Working (Netlify & AWS)

Hi everyone, 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} 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!
No description
No description
2 Replies
kapa.ai
kapa.ai11h ago
Hi @DavidFeng. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. However, based on the knowledge sources provided, it seems like you might need to check your Google OAuth app settings and ensure that the correct redirect URIs are set. In the Google Cloud Platform console, under the OAuth consent screen, you should have your redirect URIs set to <http://localhost:3001/auth/google/callback> for local development and <https://your-server-url.com/auth/google/callback> for your deployed server. Replace your-server-url.com with the actual URL of your deployed server. Also, ensure that your Google client ID and secret are correctly set in your .env.server file. Here are the relevant documentation links for setting up Google Auth in Wasp: - Creating a Google OAuth App (https://wasp-lang.dev/docs/auth/social-auth/google#3-creating-a-google-oauth-app) - Adding Environment Variables (https://wasp-lang.dev/docs/auth/social-auth/google#4-adding-environment-variables) If you're still having trouble, it might be helpful to check your main.wasp file and ensure that your Google userSignupFields and configFn match the latest implementation as shown in the OpenSaas repository (https://github.com/wasp-lang/open-saas/blob/main/app/src/server/auth/setUsername.ts#L29-L39). Please note that these instructions are specific to Wasp and may not directly apply to your deployment on Netlify and AWS EC2. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @DavidFeng, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
martinsos
martinsos10h ago
@DavidFeng this likely comes down to not setting correctly the env vars on the server (on your EC2 instance), or not configuring something correctly in your Google app. Most likely the former!
Want results from more Discord servers?
Add your server