How Can I Set Up Automatic "Refreshing" of a OAuth Client Credential Tokens

Hey,


I currently have an established OAuth Provider and have been able to successfully request a Client Credential Token. How can I automatically "refresh" this Token within Decisions?

Comments

  • Cody_Decisions
    edited November 7

    Hey there,


    I would be glad to help you out here.


    Given you have configured an OAuth Provider and successfully requested an OAuth Client Credentials Token, you should be able to configure a Scheduled Job to prevent the Client Credential OAuth Token from expiring. To do this, we first need to create a Flow containing the ResetClientCredentialsToken Step found in the Designer Toolbox under Integration -> Internal Services -> OAuthTokenService.


    You can configure this Step to use the same values as what was input for the first successfully requested Token. For any fields you do not need, you can set these inputs to NULL. As a note, you can obtain the Token ID of the first successfully requested Token by right-clicking the respective Token in System > Integrations > OAuth and copying the returned token id under Manage > Get OAuth Token ID.


    Debug this Flow to confirm that the Step is successful. If so, the next step would be to configure the Scheduled Job to utilize this Flow on a 20-30 minute interval schedule. To do so, navigate to System -> Jobs and Events -> Scheduled Jobs. Create a "New Scheduled Flow" and configure the Scheduled Flow as follows to Reset the Token every 30 minutes.

    Upon doing so, the Scheduled Job should run immediately and continue to run every 30 minutes resetting the Token on each run. A similar example and other examples using different types of Tokens can be found in the below documentation for reference.


    Creating OAuth Tokens: Creating OAuth Tokens - OAuth


    Hope this helps!


    -Cody

Sign In or Register to comment.