Regularly refresh OAuth Tokens in Yeeflow and call interfaces

This instance configuration requires a basic understanding of HTTP requests and OAuth authentication concepts.

Here, Microsoft Graph APi is used as an example, and you need to register the corresponding one yourselfAzure App ,Then obtain the corresponding Client ID and Client Secret.

Firstly, we created a new list, created corresponding fields, and maintained the first four fields within it.

Then create the corresponding list process and configure the status to be equal to the Start startup process.

Following the automatic refresh process of the configuration process,

Define receiving variables:

Explanation of HTTP Request Parameters:

HTTP Address:
https://login.microsoftonline.com/ List field:Directory ID/oauth2/v2.0/token
Method:Post
Auth Type:no select
HTTP Header:
{“Content-Type”: “application/x-www-form-urlencoded”}
Data:
client_id=List field:Application ID
&scope=https://graph.microsoft.com/.default
&client_secret=List field:Client Secret
&grant_type=client_credentials

Bold corresponds to list field variables

The variables corresponding to the status code and result configuration

If the status is not equal to 200 and fails, update the status or send an email to notify the administrator to do what you want to do.

On the line where the request ends, make a conditional judgment that the Status is equal to 200 and update the Update access_token.

After updating the access_token and performing a delay wait for the next refresh, you can configure a delay wait for the next repeated startup based on the return time (I configured it to be 110 minutes). Generally, try to refresh 5-10 minutes earlier.

So you have already obtained the corresponding access_token, and you can call the corresponding interface and authenticate in any process.
As shown in the figure below, before each request, query the corresponding access_token and assign it to the corresponding variable for use:

1 Like