W
Wasp3w ago
csbk

Using Opensaas, google auth is not working: OAUth client not found

the error message: Sign in with Google Access blocked: Authorization Error [email protected] The OAuth client was not found. If you are a developer of this app, see error details. Error 401: inval
4 Replies
kapa.ai
kapa.ai3w ago
Hi @csbk. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error "OAuth client was not found" (Error 401) when using Google Auth in OpenSaaS (Wasp) typically means that Google cannot find the OAuth client credentials you provided, or they are incorrect. Based on the knowledge sources, here are the most common causes and solutions: 1. Incorrect or Missing Google OAuth Credentials
Make sure you have created a Google OAuth app in the Google Cloud Console and copied the correct GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET into your .env.server file at the root of your project. Double-check for typos or missing values. The relevant environment variables should look like this:
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret

GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret

See the official docs for details. 2. Redirect URI Mismatch
When setting up your OAuth app in Google Cloud, you must add the correct redirect URIs. For local development, this is usually:
<http://localhost:3001/auth/google/callback>

<http://localhost:3001/auth/google/callback>

For production, add your deployed server's callback URL, e.g.:
<https://your-server-url.com/auth/google/callback>

<https://your-server-url.com/auth/google/callback>

If the redirect URI in your Google Cloud project does not match what your app is using, Google will not recognize the client and you'll get this error. See the setup step in the docs. 3. Environment Variables Not Loaded in Production
If it works locally but not in production, ensure your production environment has the correct .env.server file with the Google credentials. This is a common oversight when deploying to platforms like Fly.io. 4. Wrong Google Project or Credentials
Double-check that you are using the credentials from the correct Google Cloud project and OAuth client. Summary of steps to check: - Verify your .env.server contains the correct GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET. - Ensure the redirect URIs in Google Cloud match your app's callback URLs. - Make sure your production environment has the correct environment variables set. - If you recently changed credentials, restart your server after updating the .env.server file. If you follow these steps and the error persists, please share your Google OAuth app configuration (without secrets) and the relevant parts of your .env.server file for further troubleshooting. References:
- Wasp Docs: Setting up Google Auth - Wasp Docs: Adding Environment Variables - Wasp Docs: Creating a Google OAuth App ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @csbk, 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?
csbk
csbkOP3w ago
@kapa.ai I have done all of the above and it is still not working. Could it be that it needs time to recognise the OAuth client?
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- There is no information in the provided knowledge sources indicating that Google OAuth clients require a waiting period before they become active or recognized by Google. Typically, changes to OAuth credentials or redirect URIs in the Google Cloud Console take effect immediately. If you have verified that your credentials and redirect URIs are correct and the issue persists, the problem is likely elsewhere—such as a typo, a misconfigured environment variable, or a mismatch between the deployed environment and your Google Cloud settings. The knowledge sources do not mention any propagation delay or waiting time for OAuth client recognition by Google. If everything is set up correctly and it still does not work, you may want to double-check your configuration and environment, or try restarting your server after updating environment variables, as this is a common step mentioned in the sources. If the problem continues, further troubleshooting of your specific setup may be needed, but waiting for Google to "recognize" the client is not suggested as a solution in the available documentation or community discussions Setting up Google Auth. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @csbk, 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?
Filip
Filip2w ago
Hey @csbk, is this still a problem? I don't think it should need additional time. Something is probably off with the setup. That error message seems truncated, did it say anything else? Try going through the docs one more time and double checking you've done everything correctly (specified the correct URL in Google's dashboard, etc.)

Did you find this page helpful?