Unable to Refresh Auth in Rest Api Resource

Hello,

I have a rest api resource that uses Custom authentication to Graph Api. It includes a refresh auth workflow with a time based trigger of every hour. I noticed that the refresh auth workflow is not automatically refreshing the authentication tokens after an hour. Is there something that I missed with the Authentication?

I have snippets of the resource attached





1 Like

Hello! I'm a teammate of @bahmed. We're posting our question to the Community after bringing it up in Office Hours with @joeBumbaca.

Hey @bahmed and @awilly - Some of this might depend on version, but the auth trigger configuration will kick off the regular auth flow after the hour, and is only run on page load when viewing as an end user (not in editor mode). So that won't automatically run while using the app. The refresh auth flow is separate and should automatically run whenever a query receives a non-200 response (presumably due to a 400/unauthorized response from the auth token expiring).

Also if you're trying to use the refresh auth flow, it looks like it is configured to only send a POST request to that endpoint. That wouldn't automatically update the token variables your auth flow initially sets, you'd similarly need the variable definition steps there as well to update them.

1 Like

Thanks @jmann this helps a lot but I do have another question - How often will the auth trigger kick off if the resource was being used in a workflow? Will it not run since it only runs on page load in an app?

Also, we have various users in retool at a time. Will the auth trigger go off multiple times if multiple users were to refresh the page at the end of the hour?

Hmm I'm not sure workflows and custom auth really play well together yet. Custom auth variables are stored per user/resource, and there's not a user involved with a workflow run.