How to configure "Invoke REST API" activity to get OAuth 2.0 access token

How to configure "Invoke REST API" activity to get OAuth 2.0 access token

book

Article ID: KB0071705

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for REST and JSON 2.0.0, 2.1.0

Description

Please note this Article is for REST JSON Plugin on BW 5 only, if you have any questions for REST JSON activity in BW 6 or BWCE, please contact BW Support.

Precondition:

Every OAuth 2.0 Token Server might have its own requirements to get the Access Token, this Article shows a typical way to get the OAuth 2.0 access token for reference, the users should work with their OAuth 2.0 Token Server team for the detailed requirements.

To get OAuth 2.0 access token, the customer usually needs to get the URL for the OAuth Token server and three parameters: "client_id", "client_secret" and "grant_type". The customer also needs to know whether the OAuth Token server requires the above parameters as a "Query" parameter or a "Form" parameter.
 

Environment

Operation Systems: All

Resolution

1). If OAuth token server requires "Query" parameter:

a). Go to "Invoke REST API" activity-> "Configuration" Tab, specify OAuth Token Server URL into "Resource URI", choose Method as "POST";

b). Go to "Input Editor" tab, expand Parameters->"Query", create three parameters "client_id", "client_secret" and "grant_type" under "Query"

c). Go to "Input" tab, expand Parameters->"Query", and then specify or map values for parameters "client_id", "client_secret" and "grant_type", save the project and execute the process. The "Invoke REST API" will retrieve a new token when executing the process.

2). If OAuth token server requires "Form" parameter:

a). Go to "Invoke REST API" activity-> "Configuration" Tab, specify OAuth Token Server URL into "Resource URI", choose Method as "POST";

b). Go to "Input Editor" tab, expand Parameters->"Body"->"Form", create three parameters "client_id", "client_secret" and "grant_type" under "Form"

c). Go to "Input" tab, expand Parameters->"Body"->"Form", and then specify or map values for parameters "client_id", "client_secret" and "grant_type", save the project and execute the process. The "Invoke REST API" will retrieve a new token when executing the process.

Attached the demo project for your reference.

Issue/Introduction

How to configure "Invoke REST API" activity to get OAuth 2.0 access token.

Attachments

How to configure "Invoke REST API" activity to get OAuth 2.0 access token get_app