Referring

I think you are not using API workflows to create the new token or to refresh the token.

You should create two API workflows.

  1. GetToken
  2. RefreshToken

GetToken should generate the token for the first time when the user connect the google account for the 1st time. Within the GetToken workflow, you should schedule RefreshToken to run after X mins (depends on the token expiry)

RefreshToken will use the refresh token you got from the 1st call to refresh the token and get a new access token. Once you get the new access token, update the db entry with new data (tokens and expiry). Within this workflow add another schedule workflow action to schedule itself (RefreshToken) after X mins. This will take care of subsequent run for the future.

I hope this helps.

Feel free to reach out if you need more help.

1 Like