Requesting a token works in Postman but errors in a Logic App HTTP post

Jon Farmer | Stiperstone 0 Reputation points
2025-04-29T10:52:57.69+00:00

I have successfully got a token using Postman send the following as application/x-www-form-urlencoded.

Posted to https://login.microsoftonline.com/

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
24,673 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rukmini 2,356 Reputation points Microsoft External Staff Moderator
    2025-05-01T03:55:44.25+00:00

    Hello @Jon Farmer | Stiperstone,

    I got the same error, when passed the same request body:

    
    grant_type=client_credentials  
    
    client_id: ClientID
    
    client_secret: Secret 
    
    scope: https://graph.microsoft.com/.default
    
    

    User's image

    User's image

    The error is because you are passing the request body is incorrect:

    • You are using a JSON-like structure (with colons and line breaks), which is not valid for the application/x-www-form-urlencoded content type.
    • The application/x-www-form-urlencoded format expects the parameters to be encoded as a string in key-value pairs, separated by &, and the keys and values should be URL-encoded if needed.

    To resolve the error, pass the request body like below:

    
    grant_type=client_credentials  
    
    &client_id=ClientID  
    
    &client_secret=Secret  
    
    &scope=https://graph.microsoft.com/.default
    
    

    And the Headers as Content-Type : application/x-www-form-urlencoded

    User's image

    When I run the workflow, access token generated successfully:

    User's image

    Hope this helps!


    If this answers your query, do click Accept Answer and Yes for was this answer helpful, which may help members with similar questions.

    User's image

    If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.


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.