W
Wasp•4mo ago
BeReal

Google OAuth help

Hi I am a bit stuck, I am using the Saas Template and trying to add Google OAuth, I have followed all the steps in the documentation but am stuck probably due to my lack of experience. I am trying to test locally the OAuth I have added localhost as a redirect uri in my google cloud console. When I click sign up with google I get redirected to http://localhost:3001/auth/google/login where I get a refused to connect error. If i change the port to 3000, i do not get the error but just nothing happens. I have two questions what is going on with the 3000 and 3001 ports, should I specify the ports somewhere? Secondly, what could be the reason my google oauth is not working?
4 Replies
kapa.ai
kapa.ai•4mo ago
Hi @BeReal. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I understand that you're having trouble with Google OAuth in your Wasp project. Let's try to address your issues one by one. 1. Ports 3000 and 3001: In a typical Wasp project, the client-side code runs on port 3000 and the server-side code runs on port 3001. When you're setting up Google OAuth, the redirect URI you specify in your Google Cloud Console should point to the server, hence it should be <http://localhost:3001/auth/google/callback> [^1^]. 2. Google OAuth not working: There could be several reasons why your Google OAuth isn't working. Here are a few things you can check: - Make sure you've correctly set up your Google OAuth app in the Google Cloud Console, and that you've correctly copied your Client ID and Client Secret [^1^].
- Check your main.wasp file to ensure you've correctly set up the auth methods section, specifically the Google OAuth section [^2^].
- Ensure you've added the Google client id and secret to your .env.server file [^2^].
- If you're using an outdated saas template, consider using the latest one from https://opensaas.sh [^2^].
- Check your Google userSignupFields and configFn in your main.wasp file to ensure they match the latest implementation [^3^]. If you're still having trouble, you might want to share your project or relevant code snippets with the Wasp community for more specific help. ^1^]: [Wasp Docs - Setting up Google Auth (https://wasp-lang.dev/docs/auth/social-auth/google#3-creating-a-google-oauth-app) ^2^]: [Discord Support Thread - Oauth redirects to localhost:3001 instead of 3000 (https://discord.com/channels/686873244791210014/1208366712450195466) ^3^]: [Discord Support Thread - Google Auth in Prod (https://discord.com/channels/686873244791210014/1222916615151161374) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @BeReal, 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?
miho
miho•3mo ago
Please go through the Google OAuth setup Wasp docs one more time 🙂 https://wasp-lang.dev/docs/auth/social-auth/google
Google | Wasp
Wasp supports Google Authentication out of the box.
BeReal
BeRealOP•3mo ago
Hi I did that and still don't get what I am doing wrong would anyone have a working example of a one page project with working auth? I managed to find out what the error was I wasn't looking well enough at the logs, my auth was working fine but there was another error which made it look like it was not working, thanks for the help!
miho
miho•3mo ago
Sorry for not responding yesterday, I'm glad it worked out for you! It's always good to go through the server logs to see if there are errors and then share them here 😄 Good luck building and let us know if we can with anything else!
Want results from more Discord servers?
Add your server