API Rest error 400 : Delegation denied for

I have created a REST API resource that allows me to send emails from my Gmail account through apps and workflows. The resource is used in both apps and workflows. However, a few days ago, I started receiving a prompt to re-authenticate the resource in a workflow (see attached image). After re-authenticating, the issue persists. At that point, the workflows stopped working, but the apps continued to function correctly.

Today, I encountered the same error in an app, but only in production—staging works fine. This indicates that the connection with Gmail is functioning properly and suggests the issue lies within Retool.

I have tried changing the "client secret," revoking the tokens, and even creating a new resource, but I still face the same error. I’ve attached an image of the error shown in the console.

Is anyone else experiencing a similar issue? Any ideas on how I can resolve this?

Thanks!!!


Captura de pantalla 2025-01-13 132020

Hello @Lucia_Gomez,

Apologies for this odd behavior, this is a very weird bug. I am very confused how it was working fine and somehow now is not working.

From the error message, I think that on the Google end you might need to change the permissions since it seems the error is coming from Google on auth attempt and the Google server is telling Retool that your email address of lucia.gomez@electromaps.com does not have permission :thinking:

We may need to troubleshoot further in office hours as well to test out the auth flow and look at the auth setup.

Hello @Jack_T !! Thanks for your response!

I managed to fix the bug. It turns out that the authentication needs to be done directly from the Google account I want to use to send emails, even if the credentials are shared between users.

But now I’ve run into another issue. Each environment requires a different token, so if I want to work in staging, I have to update the token. However, when I switch to production, it gives me an error, and vice versa.

Do you have any idea how I could solve this?

Thanks again!

1 Like

Hi @Lucia_Gomez,

Great to hear you solved that issue!

Unfortunately there is not a way to share auth tokens across environments :sweat:

You will just have to re-do the auth process when we switch over to a different once. I believe this is likely done for security purposes.