Issue: Custom API setup with Multiple Environments

Hello! I'm having trouble connecting a particular GraphQL resource to our Retool instance.

We set up the production and staging environments for this resource. The connection for production works as expected, but when we switch to staging, it looks like it can't authenticate correctly based on the steps we defined in the Custom API flow.

We essentially do an OAuth request, then make an API request that should set-cookie a cookie header on the Retool side. What I'm observing is that if I'm on the staging environment and I test the OAuth connection, it on the redirect it seems to set-cookie on the production environment, not the staging environment.

To debug this, I saved the value of set-cookie into a magic variable:

Then I initiated our OAuth flow. Then, when checking the variables, I noticed the magic variable wasn't set on staging:

Yet it is set on production, which is not the environment where I initiated this OAuth flow:

The only workaround I can think of right now is to make separate resources for production and staging, but this is long-term not feasible for my team. Can I get help in debugging this / guidance on how to fix this, or if this requires the eng team to take a look?

Thanks!

It also may be worth mentioning that we are using the same generic client id and secret for OAuth with both environments.

Hi @Jesse_Zhou Thanks for reporting! We'll do some testing with a similar set up :thinking: We are looking into a related issue, but the issue was more sporadic. It sounds like this is happening consistently?

I do agree that the separate resources is a good solution to move forward with your app until we have a true fix

Can we see the rest of the resource/auth set up to try to reproduce? So far, I'm not seeing this issue. Also, what version of Retool are you on?

Hi @Tess -- sorry for the late reply. I will DM you the setup if that's ok.

Yep! Thank you

We also have been experiencing this issue. Ours just gets returned from our api saying the auth token has expired when we hit our staging environment. When we are pointed to production it all works as expected. The moment we switch over to staging it just does not try to re-authenticate it only try's to pull a refresh token. And if I add an authentication button somewhere in the app to kick of the process manually it does the same thing where it trys to pull a refresh token instead of actually authenticating. We are using google sso and our users are logging into the retool app with google sso as well.

Note, for us this does not effect users, only developers and testers because we are the only ones switching to another environment but it does hamper our ability to test new functionality drastically.