When using Custom Auth (OAuth2) API requests are unbearably slow

Until recently, we have been using the regular OAuth2 configuration for getting the access token of a user and send API requests with.
We have tried to switch to a Custom Auth (To extract some info from the JWT access token - which is not possible to do with the regular OAuth2) and immediatelly noticed that all our API requests became much much slower (In the image you'll see 5 seconds vs 85).
In addition, when the API request returns a status 400, a retry is made (Without any notification or knowledge, totally Retool internal it seems) which it seems waits for 30+ seconds before retrying, making the whole query run for almost 3 minutes before failing)


To replicate this, we've sent a request when the Authentication is set to OAuth2. Then we've switched into the Custom Auth (OAuth2 Generic) - and without even reseting the app state or re-authorizing, just sending the request, we get a VERY slow response.
Switching the authentication back to OAuth2 makes the query run quicker again.

I have no idea what happens as part of this Custom Auth but this is totally not usable at this state.

  1. Is there anything that can be done?
  2. Is there any way to extract or get some information from the JWT token that we have?

Hey @slavab! Mind sharing how you have the Custom Auth set up? We haven't seen queries runtimes differ that dramatically with Custom Auth, but would love to see what is going on there so we can get to the bottom of it for you.

Hi @joeBumbaca ,
Sure thing. Those are the images that represent what we have set up


Again, simply switching between this custom auth setup and the regular OAuth2 changes the runtime of the same exact query (Which is an API request)

Thanks @slavab! Was able to set up a resource with this same custom auth. Didn't notice a difference in query execution time on my end. Can you share the query runtime pop up for when it takes 35s?

Sure thing @joeBumbaca
What i do is set up the Custom Auth. Then i "Auth" with it, and then switch between the OAuth2 and the Custom Auth, since the OAUTH2_TOKEN variable is already set up on the Resource side.
This is a PUT request - On GET ones, this behavior usually doesn't happen, but queries take somewhat longer in general as the whole App is immediately slower when i switch to the Custom Auth

The query with regular OAuth 2
Screenshot 2023-12-24 at 9.50.18

And the same one with Custom Auth (OAuth 2 Generic)
Screenshot 2023-12-24 at 9.49.14

Please note that on the server side, the request itself takes ~1 second. However, i see that there is around a 30-60 second difference between when i run the query on Retool until i actually get the request to the server. This behavior does not occur when using OAuth2, only while using the Custom Auth.

I do want to mention that i have stumbled upon 2 other topics that seem to describe a somewhat similar case, but without a specific answer. Both for Custom Auth

Hey @slavab, sorry for the delay here. Our eng team was able to find a performance bug in certain custom auth setups. I've toggled on a feature flag with the fix for your org. When you get a chance, can you test out the custom auth again and let us know if you see improved query runtimes? Thanks.