refresh OAUTH2 access token(a,b,c,d,e,f,g,h,i)
Group |
Uses a refresh token to get a new OAuth2 access token (and a new refresh token) for an HTTP channel and replaces the old ones there. Returns true for success, false otherwise (but no exception). The function can only succeed if the channel has already fetched an OAuth2 access token. In this case, you will also see the expiration time of this access token at the very bottom of the channel. The function is only executed if the expiration time has been reached (or 20 seconds before). If the function was successful, the expiration time in the channel will also be updated.
Note: The additional IDs of the channel contains the access token under the name SYS_HTTP_OAUTH2 and the refresh token under the name SYS_HTTP_OAUTH2_REFRESH.
Note: Optionally, the parameters can be specified in the URL. If these are missing, the default values for OAuth2 will be used. You can also use placeholder, which are filled with values of the corresponding function parameters or with corresponding values from the OAuth2 configuration in the channel. See example in column 3 below. In addition to the placeholder used in the example below, you can use placeholder <server>. It will be filled with the content of field Partner address in the channel. If that field, for example, contains the value https://example.com, then <server> will be replaced with example.com.
Description of Parameters
Parameter |
Description |
a |
URL endpoint for the refresh operation. If no URL is specified, the OAuth2 Refresh URL from the channel will be used. Note: You can add &useCredentialsInHeader to the URL, for the credentials ( client ID and client secret ) to be specified in the header instead of the body. |
b |
true, to use the DMZ server for the HTTP request (if it exists). |
c |
HTTP channel ID. |
d |
Client ID or empty if specified in channel. |
e |
Client secret or empty if specified in channel. |
f |
Refresh token or empty if specified in channel. |
g |
Content type for POST. Default: application/x-www-form-urlencoded |
h |
true, to use HTTP GET instead of POST. Default: false |
i |
(optional) The scope . |
Example
Parameter a |
https://example.com/oauth/token |
https://example.com/oauth/token |
https://example.com/oauth/token?grant_type=refresh_token&client_id=<clientId>&client_secret=<clientSecret>&refresh_token=<refreshToken> |
Parameter b |
false |
false |
false |
Parameter c |
12345678900 |
0 |
12345678900 |
Parameter d |
|
|
myClientIDToUse |
Parameter e |
|
|
mySecretToUse |
Parameter f |
|
|
myRefreshToken |
Parameter g |
|
|
text/html |
Parameter h |
true |
|
|
Parameter i |
|
|
|
Result |
true |
false |
true |
Remark |
Channel has been updated. |
Invalid channel ID. |
The placeholders <...> have been replaced by the values of the corresponding function parameters and the channel has been updated. |