Outbound REST API with custom header form OAUTH

RC22
Tera Expert

How can I pass a custom header as part of the API call I make and from which I have received during the OAuth authentication? 

 

Example: I am using the OAuth Application registry to save the credentials(Client ID and Secret) for a third party with grant type being client credentials.

When I call the token URL I get the access_token as part of the response body and now I want to pass the same access_token to API calls I need to make. how can I achieve this?

 

I did debug the OAuth script and as part of the postprocessAccessToken, I see access_token is added to paramMap. can somehow I use what is there is the paramMap?

2 REPLIES 2

Tony Chatfield1
Kilo Patron

Hi, normally an external access_token would be populated into 'oauth_credential' table and you would access it from there.
If you are receiving another parameter\value in your payload that you want to do something with, you should be able to script this from within an extension of OAuthUtil postprocessAccessToken

Can you provide clearer details of your issue\requirement?

Manash_H
Tera Contributor

You can Create a Script Include to trigger your Outbound Rest Calls - This should take care of your rest calls.

 

var request = new sn_ws.RESTMessageV2('Rest Message Name', 'HTTP Method Name');
            request.setAuthenticationProfile('authentication_type','sys_id of oauth_entity_profile');
            var response = request.execute();