google login custom domain
I tried setting up google login with my custom domain deploying with fly.io and for some reason i tried logging in with google and it never logged in. I checked this out and it seemed to be because of the wasp client url that we have to set.. i had a "/" at the end and maybe that was it. But now when i try to get in to my wasp app that is deployed i cant login with any user or use the google login. Im not sure what happened, but i even deleted the client server from fly and re created it and the problem persists
21 Replies
Hi @tomas.morales. 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 issues with Google Authentication on your Wasp app deployed on a custom domain via Fly.io. Here are a few steps you can take to troubleshoot the issue:
1. Check your Google Configuration and Code: Ensure that your Google configuration and code are set up correctly. In development, it works well on your local machine, which indicates that your Google configuration and code might be correct. However, it's worth double-checking. You can refer to the Wasp Google Auth documentation (https://wasp-lang.dev/docs/auth/social-auth/google) for guidance.
2. Check your Environment Variables: Make sure you've set the necessary environment variables correctly, especially
WASP_WEB_CLIENT_URL
. This should be set to your custom domain (without a trailing "/"). If you're using an external authentication method like Google, you also need to set the necessary environment variables required by these methods. You can check if you've added your secrets correctly by running flyctl secrets list
in the terminal (source (https://wasp-lang.dev/docs/advanced/deployment/manually#set-up-a-flyio-app)).
3. Set up a Custom Domain: If you're using a custom domain, ensure that you've set it up correctly. This involves adding your domain to your Fly client app, adding the DNS records for your domain, and setting your domain as the WASP_WEB_CLIENT_URL
environment variable for your server app (source (https://wasp-lang.dev/docs/advanced/deployment/cli#using-a-custom-domain-for-your-app)).
4. Check your User Database: If you've previously logged in with the same email address using the Email method, it might cause issues. You can run wasp db studio
and delete that user, then try logging in again (source (https://discord.com/channels/686873244791210014/1208366712450195466)).
If you've checked all of these and the issue persists, it might be helpful to share any error messages you're seeing or more details about your setup.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @tomas.morales, 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?its working fine in local and for some reason it got stuck with the google login problem and now i cant login with any user even after the recreate of the client server
i also deleted the created user and all, but it is detecting somehow that it has a user logged in with google and because of the url problem it couldnt "verify" that login.. so that is the problem i am having
its weird because now in all my devices (ones that i didnt login before) i cant login with any user
ztudia.cl
if you want to check out the problem, you will notice the login in landing page is not there and when i put comenzar it takes me to register and i cant register or login
i just discovered it seems to be because of the CORS blocking my requests from front end to backend
ok solved it, my env var wasnt being set because i missed a space at the end, sorry for the troubles
@tomas.morales I'm having the same issue. How have you adjust your env var?
Your problem is that your front cant call your backend?
You need to make sure that you set the env variable for the frontend url in your server
That way wasp makes sure the server accepts requests from that url
In my case it was setting
WASP_WEB_CLIENT_URL=https://ztudia.cl
I had a script to add env variables to my server deployed in fly.io and it wasnt taking into account the last env var if i didnt have an empty line at the end of my .env.server.prod file
So that was my issue, the variable for frontend url wasnt being set
@tomas.morales Thanks for your response! I might have a slightly diffrent issue. I'm using Railway, have added all env variables to the Server but still get these issues in the console:
signup:1 Access to XMLHttpRequest at 'https://server-production-....railway.app/auth/me' from origin 'https://client-production-....railway.app' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
index-Bpk1JXu_.js:57
GET https://server-production-....railway.app/auth/me net::ERR_FAILED 401 (Unauthorized)
Did you check if the env var is actually set in the server? I also thought i had it until i printed it
That cors problem with wasp i would think only comes up with that env var not being correctly set as the server then uses it to allow cors
@tomas.morales Hmm I think so π at least, I have added the variables to Railway's variables section of the server
![No description](https://cdn.answeroverflow.com/1250193057593426051/image.png)
And that client url is the same url you use to access your app through the web?
yeah exactly
With https?
yes (unfortunately haha)
Do I maybe have to add REACT_APP_API_URL as an env variable to the .env.client file which is used in production as well?
Dont think so its the server blocking, not the client
Setting the
WASP_WEB_CLIENT_URL
should be enough π You can't access the app from the old client URL, only the new one.can you elaborate on this? Where did you deploy to and how did you set your env vars?
Its what i said afterwards, i had a script to set env vars and without a space at the end of the envs file it didnt read the last var (the client url)