How to set the Headers for Oauth Signature Method (HMAC-SHA256) in :Logic app to send the message to OAuth API

AboorvaRaja Ramar 41 Reputation points
2022-11-23T06:20:20.543+00:00

Hi

I have an API service which is OAuth authenticated with the Signature method as (HMAC-SHA256). I am able to connect with Postman and send the request but unable to send the request from Logic app. getting login failure.

263314-oauthauthentication.png

Error message:

            "detail": "Invalid login attempt. For more details, see the Login Audit Trail in the API UI at Setup > Users/Roles > User Management > View Login Audit Trail.",  

263268-oauthauthentication2.png

I have tried adding the Authorization in the header but still not working. Please advice what is wrong.

263326-image.png

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
0 comments No comments
{count} votes

Answer accepted by question author
  1. MayankBargali-MSFT 70,986 Reputation points Moderator
    2022-11-25T07:35:00.5+00:00

    @AboorvaRaja Ramar Thanks for reaching out. Postman has the inbuild java scripts that does the magic and creates the right header for you while sending the request.
    There is no out of box solution to set the OAuth Signature Method (HMAC-SHA256) so you need to generate the right header that your endpoint accepts and pass the same leverage the HTTP action in logic app.

    I am not sure how and what other headers your API validates at their end. Sharing one of previous discussion where the endpoint accepts api-auth-id and api-auth-signature at their endpoint end as per the documented at the endpoint end.

    I believe the string construction would be same for SHA256 just changing the oauth_signature_method value as per the RFC standard which you need to pass as the Authorization header while calling your endpoint.
    Alternative you can capture the request generated by Postman (how request is built and what actual HTTP header are passed) using fiddler and use the same to generate the right Authorization header or you need to reach out to your endpoint team to know what is the right header that is accepted by them.

    For any calculation or to generate the stings you can first try to leverage the inbuild function expression. If it doesn't help, then you can try to leverage the inline code. But in case if there are some libraries that cannot be used in inline code then you need to offload your logic to function app.


1 additional answer

Sort by: Most helpful
  1. AboorvaRaja Ramar 41 Reputation points
    2022-11-28T13:59:17.97+00:00

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.