W
Wasp2mo ago
NEROX

Unable to login with the OAuth provider.

5 Replies
kapa.ai
kapa.ai2mo ago
Hi @NEROX. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the knowledge sources, it appears you're experiencing an issue with OAuth login after deploying your Wasp application. Here are a few potential reasons and solutions for this problem: 1. Incorrect redirect URL: Make sure you've updated the redirect URL in your OAuth provider's dashboard (Google, GitHub, etc.) to match your deployed server URL. The new format for the redirect URL is:
{serverUrl}/auth/{provider}/callback

{serverUrl}/auth/{provider}/callback

For example: <https://your-server-url.com/auth/google/callback> Migration from 0.12.X to 0.13.X (https://wasp-lang.dev/docs/migrate-from-0-12-to-0-13) provides information on this change. 2. Missing WASP_SERVER_URL environment variable: Ensure you've set the WASP_SERVER_URL server environment variable in your deployment environment. This is a new requirement in Wasp 0.13.0. Migration from 0.12.X to 0.13.X (https://wasp-lang.dev/docs/migrate-from-0-12-to-0-13) mentions this new requirement. 3. Incorrect client URL: Make sure your WASP_WEB_CLIENT_URL is set correctly in your deployment environment. Fly.io (server and database) (https://wasp-lang.dev/docs/advanced/deployment/manually#set-up-a-flyio-app) mentions the importance of setting this correctly. 4. Misconfigured OAuth provider: Double-check that you've correctly set up your OAuth provider (Google, GitHub, etc.) and added the necessary environment variables to your deployment. Setting up Google Auth (https://wasp-lang.dev/docs/auth/social-auth/google#3-creating-a-google-oauth-app) and Setting up Github Auth (https://wasp-lang.dev/docs/auth/social-auth/github#3-creating-a-github-oauth-app) provide guidance on setting up these providers. To troubleshoot further, you can: 1. Check your server logs in the Fly.io dashboard for any error messages. 2. Use the browser's developer tools to inspect the network requests and see if there are any specific error responses from your server. If you're still unable to resolve the issue, you may want to consider redeploying your application, as one community member reported that redeployment solved their login issues. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @NEROX, 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?
NEROX
NEROXOP2mo ago
@kapa.ai I did a: wasp deploy fly cmd secrets set WASP_SERVER_URL=https://api.elmossetgourmet.es --context=server and I'm deploying with the var: REACT_APP_API_URL=https://api.elmossetgourmet.es wasp deploy fly deploy still having the problem, what's wrong?
kapa.ai
kapa.ai2mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Based on the information provided in the knowledge sources and your current setup, there are a few things to consider: 1. Environment Variables: You've set WASP_SERVER_URL correctly for the server, which is good. However, for the client-side, you're using REACT_APP_API_URL. In Wasp, the recommended variable for the client to know about the server URL is WASP_WEB_CLIENT_URL. 2. Client-side Environment Variables: It's important to note that client-side environment variables (like REACT_APP_API_URL) are embedded into the client code during the build process, not at runtime. Setting it during the deploy command might not have the effect you're expecting. 3. Correct Variable Usage: According to the Accessing the configuration (https://wasp-lang.dev/docs/advanced/accessing-app-config#client-configuration-object) documentation, the client should use config.apiUrl to access the server URL, which is set by REACT_APP_API_URL. Here are some steps you can try: 1. Set the server URL for both server and client:
wasp deploy fly cmd secrets set WASP_SERVER_URL=<https://api.elmossetgourmet.es> --context=server
wasp deploy fly cmd secrets set WASP_WEB_CLIENT_URL=<https://elmossetgourmet.es> --context=server

wasp deploy fly cmd secrets set WASP_SERVER_URL=<https://api.elmossetgourmet.es> --context=server
wasp deploy fly cmd secrets set WASP_WEB_CLIENT_URL=<https://elmossetgourmet.es> --context=server

2. For the client-side build, you need to set the REACT_APP_API_URL during the build process. Instead of setting it during deployment, try this:
REACT_APP_API_URL=<https://api.elmossetgourmet.es> wasp build
wasp deploy fly deploy

REACT_APP_API_URL=<https://api.elmossetgourmet.es> wasp build
wasp deploy fly deploy

3. Make sure your OAuth provider's dashboard (Google, GitHub, etc.) has the correct redirect URL: <https://api.elmossetgourmet.es/auth/{provider}/callback> 4. Double-check that all necessary environment variables for your OAuth provider are set correctly on the server side. If you're still experiencing issues after these changes, you might want to check the server logs for any specific error messages. You can access these logs using:
wasp deploy fly cmd logs --context=server
wasp deploy fly cmd logs --context=server
Remember, as mentioned in the Defining Env Vars in Production (https://wasp-lang.dev/docs/project/env-vars#defining-env-vars-in-production) documentation, client-side environment variables are embedded during the build process, so changes to these variables require a rebuild of the client. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @NEROX, 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?
NEROX
NEROXOP2mo ago
Two in a row today Kapa! here you have a croqueta:da_cookie:
miho
miho2mo ago
Nice! A bit of albodingas as well!

Did you find this page helpful?