How to run oauth logic before an action?

How to run oauth logic before an action?


0

I have a number of actions that interact with a REST API which were generated using the “import from OpenAPI” function. One of those actions is a ‘v1/token’ for oauth for the other actions. Whats the most elegant way to use this action before the other actions to ensure I have the correct ‘accessToken’ in the other actions?

I assume I will have to

  1. Modify each OpenAPI generated action to run another “auth” action
  2. The “auth” action would store tokens in Hasura Postgres db and a) check if a valid token exists and if not b) fetch a new token and store it and then c) pass it to the original OpenAPI generated action
  3. The OpenAPI action uses the token in its header

Not sure how to do this flow in Hasura if this is the correct way to do it.


Load 3 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *