Solved

How Pass Token in API Key when Authentication Method is Bearer

  • 29 January 2023
  • 5 replies
  • 274 views

Userlevel 3
Badge +7

Hi All, 

We have scenario when API Key is Dynamic and each time we have to send new Token. 

Is it any method or configuration. 

Regards, 

Kishore Nenwani

icon

Best answer by envkishon 30 January 2023, 07:39

View original

5 replies

Userlevel 7
Badge +20

Hi @envkishon 

If you are sending this using PLSQL_REST_SENDER_API, then authentication can be added in the http_req_headers_  parameter. By this way you can add dynamic api key in the request.

In the routing address, set the authentication method to None.

Eg:

plsql_rest_sender_API.Call_Rest_EndPoint(rest_service_ => 'YOUR_MESSAGE_FUNCTION',
xml_ => bxml_,
callback_func_ => 'P_L_S_Q_L_Rest_Test_API.REST_callback_Test',
http_method_ => 'POST',
http_req_headers_ =>'Content-Type: application/xml,Authorization: Bearer YOURAPIKEY');
END;

Hope it helps!

Damith

Userlevel 3
Badge +7

Hi Damith, 

I tried it, it is not working

 

 

 

Userlevel 7
Badge +20

Options in the address line are one from the routing address setup, but when we add headers when creating the message in PLSQL_REST_SENDER_API, they should be added to the transport. Can you check the receiving end and see what are the http headers passing from IFS?

 

Regards,

Damith

Userlevel 3
Badge +7

Hi Damith, 

If it is in failed/waiting state then how it will transferred at Receiving end. 

 

Regards,

Kishore Nenwani

Userlevel 7
Badge +20

Hi Damith, 

If it is in failed/waiting state then how it will transferred at Receiving end. 

 

Regards,

Kishore Nenwani

Hi @envkishon 

 

Do you know why it’s failing? Is it due to an error with your receiving endpoint or due to HTTP response code other than HTTP 200?

If the receiving end sends HTTP response code other than 200, then you can add them in the REST sender ACCEPTED_CODES so application message will be finished.

 

Otherwise you can use something like Postman Mock Server to receive the response and see how the response headers and content looks like.

 

Regards,

Damith

Reply