Activation of Google and GitHub AUTH on saas project
Hello everybody ! Pretty new to wasp, and even on web dev. I am currently working on the SaaS template and wanted to activate Google & GitHub AUTH. I activated it in the auth dictionnary, and the buttons appear on the login page. The problem is that when I click either of them, it redirects me on this url http://localhost:3001/auth/google/login which doesn't exist. I may be missing something but right now, I don't understand the problem.
Thanks for your advices
17 Replies
Hi @Julien. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
It seems like you're experiencing a common issue with OAuth setup. Here are a few steps you can follow to troubleshoot:
1. Check your Google OAuth setup: Make sure you've followed the steps in the Wasp documentation (https://wasp-lang.dev/docs/auth/social-auth/google#3-creating-a-google-oauth-app) to set up your Google OAuth app correctly. Pay special attention to the Authorized redirect URIs section. It should be set to
<http://localhost:3001/auth/google/callback
> for local development.
2. Check your GitHub OAuth setup: If you're also using GitHub for authentication, ensure you've followed the steps in the Wasp documentation (https://wasp-lang.dev/docs/auth/social-auth/github#setting-up-github-auth) to set up your GitHub OAuth app correctly.
3. Check your .env.server file: Ensure you've added the Google client id and secret to your .env.server file as mentioned in the Discord support thread (https://discord.com/channels/686873244791210014/1208366712450195466).
4. Check your OAuth configuration in Wasp: Make sure you've correctly configured the Auth object in your main.wasp
file as shown in the Wasp documentation (https://wasp-lang.dev/docs/auth/social-auth/overview#ui-helpers).
5. Check for outdated templates: As mentioned in the Discord support thread (https://discord.com/channels/686873244791210014/1208366712450195466), if you're using an outdated SaaS template, you might face some issues. It's recommended to use the latest template from https://opensaas.sh.
If you're still facing issues after following these steps, please share more details about your setup, and we can help you troubleshoot further.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Julien, 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?Hey @Julien, why do you think the URL doesn't exist? You may be viewing it as a frontend url, but it's actually a backend endpoint (notice the port is 3001).
In any case, like the bot suggested, this sounds like a redirct URI issue. Check the Google and Github auth setup docs for details: https://wasp-lang.dev/docs/auth/social-auth/google
Sorry, I sometimes don't choose the right word, as english isn't my native language. I had already followed the 4 first suggestions the bot gave me and I tried the 5th. It seems to be working when I get the template from the github repo instead of the wasp new NAME -t saas command
Hey, No worries about your English, I wouldn't guess you weren't a native speaker π
As for the problem... Interesting, just to make sure I got this correctly:
- You confirmed Google login is working when you clone the OpenSaas GitHub repo and work from there.
- You confirmed Google login isn't working when you do
wasp new <app-name> -t saas
.
And this is without doing anything else besides creating the project and running it?
If I got everything right, I'll try to reproduce this and see what's the problemYes exactly. On both methods, I only uncommented google and GitHub auth in the main.wasp
Ok, thanks for reporting, I'll investigate ASAP
No problem. Let me know if you need other information π
Wohooo @Julien, you just became a Waspeteer level 1!
@Julien , what is your
wasp
version? You can check it out by doing wasp version
Hello, my wasp version is 0.13.2
Ok, I"m assuming you're taking over here π
Could you maybe share your code in a Github repository so we can test out the code and see what's up?
I made a new project with the github repo directly. Let me try to reproduce it and I'll share the code
Ok, so I tried again, and now it seems to be working. I don't know why, but I think that until now, when I wasp start, the server application on 3001 port wasn't launching
@Julien that sounds very weird!
Is it still true that it works for you if you do it from Gh repo , but not if you do it via
wasp new
?
To check if server is running, you can just go to localhost:3001
and you should see someting like Hello world
if it is running.It works both ways now