'Invalid request' error on Logic App for http POST?

Lovely Joy Orola 0 Reputation points
2023-06-21T05:59:22.48+00:00

I create an HTTP POST action in my logic app, and here is the setup I made. But I received an "invalid request" error when I tried to run it. How can I resolve this?

User's image

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,543 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,936 Reputation points Moderator
    2023-06-26T09:56:22.57+00:00

    @Lovely Joy Orola Thanks for reaching out.

    It looks like the error is coming from the token endpoint when you pass the request that was not valid.

    As per the documented from Graph API you need to pass as below to get the token.

    POST https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token HTTP/1.1 Host: login.microsoftonline.com Content-Type: application/x-www-form-urlencoded client_id=535fb089-9ff3-47b6-9bfb-4f1264799865 &scope=https%3A%2F%2Fgraph.microsoft.com%2F.default &client_secret=qWgdYAmab0YSkuL1qKv5bPX &grant_type=client_credentials
    

    Your body is not valid as the scope needs to pass as HTML encoded i.e. &scope=https%3A%2F%2Fgraph.microsoft.com%2F.default or there may be space etc. in your dynamic parameter which would have caused the error.

    I will suggest you to review your run history and validate if the Body is correctly generated as per the graph API document.

    In case if you are still facing the issue then please share the run history HTTP action output so I can validate it at my end.

    Please "Accept Answer" if the answer is helpful so that it can help others in the community.

    0 comments No comments

Your answer

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