The SetOAuth2Token component is used to handle the process of retrieving and refreshing Access and Refresh tokens as specified in the OAuth2 protocol. Access tokens are used to authorize calls to endpoints / applications, i.e. email or a cloud platform. An access token is sent along as part of requests to these applications, often as an 'Authorization' header.
Important! To trigger the process of continuously refreshing tokens in order to have a valid access token available at all times this component needs to be combined with a Scheduler component. Read more about how to setup Scheduling SetOAuth2Token component below.
This component has the following configuration options:
- Authorization URL
- Token URL
- Client Id
- Client Secret
- Refresh Token Delay
- Header name - Global variable
- Redirect URL and Authorize
The URL used for first contact with and authorization on the authorization server.
- The Authorization URL is specified in the (API) documentation of the application you require access to.
The URL used for getting and refreshing the access token from the authorization server.
- The Token URL is specified in the (API) documentation of the application you require access to.
Public key called 'Client Id' used to identify the application you want to connect to.
- The Client Id is created in the application you require access to.
Secret key called 'Client Secret' used to authenticate on the authorization server.
- The Client Secret is created in the application you require access to.
Specify the permissions that are granted to an access token.
- The Scope settings are specified in the (API) documentation of the application you require access to.
Refresh Token Delay
Defines how many seconds before the expiration time an access token is allowed to be refreshed, default is
Header name - Global variable
The name of the header and global variable for setting / storing the access token.
Redirect URL and Authorize
On the bottom of the settings you see the
redirect URL for the test and production environment.
Paste the applicable redirect URL into the settings of the application you require access to (you can use the
Authorize button after you've completely set up the component and settings in the application you require access to. A popup appears prompting you to fill in the user credentials and optionally consent to the required permissions.
OAuth2 token received with success! message appears you've succesfully retrieved the first set of access and refresh tokens.
Scheduling SetOAuth2Token component
The SetOAuth2Token component has to be combined with a Scheduler component in order to periodically check if the access token can be refreshed. The refresh window is the time between (expire_date minus Refresh Token Delay) and the expire_date.
For example, if your access token is valid for 60 minutes and the Refresh Token Delay is set to 1 minute:
- The refresh window is between 59 and 60 minutes.
(Technically you can refresh after the expire_date, but you won't have a valid access token from 60+ minutes onwards until the access token is refreshed.)
- Your Scheduler has to trigger within this refresh window and therefore its Repeat Interval has to be lower than the Refresh Token Delay time.
- Set Scheduler Repeat Count to -1 so it repeats indefinitely.
OAuth2 Global variables
After succesfully setting up the component the following Global variables will be set:
|Global variable name||Description|
|The access token|
|The Client Id|
|The Client Secret|
|The unix timestamp of the expiration date & time|
|The Redirect URL|
|Flag for refreshing status:|
1 => token is being refreshed
(other processes will not be allowed to refresh this token simultaneously)
0 => token is not being refreshed
(a process is allowed to start refreshing the token)
|The refresh token|
|The Authorization URL|
|The Token URL|
Important! Editing any of these Global variables can break the process of refreshing of tokens.
- This component uses The OAuth 2.0 Autorization Framework.
- How long access & refresh tokens are valid, Client Id, Client Secret, Token URL, Authorization URL and Scope are defined by the application you require access to. Please refer to your application (API) documentation.