0

I have a logic setup with an HTTP POST action to retrieve a token, I have implemented my logic app as follows, but whenever I execute it, I receive the error 'Invalid request'. On Postman, the same works, but not here. How can I fix this?

enter image description here enter image description here

See below for my setup on Postman: enter image description here

Vivek KB
  • 49
  • 6
  • Can you share how your Postman is set up to compare? – Anthony Norwood Mar 06 '23 at 20:10
  • Unfortunately, it’s extremely hard to help given you’ve had to redact all of the key content. Anthony’s request for your postman setup is an important one. We really need more info to help. – Skin Mar 06 '23 at 20:46
  • I have updated my question with Postman screenshot. Also note that even after setting content-Type to application/x-www-form-urlencoded I get the same error – Vivek KB Mar 06 '23 at 20:48
  • 2
    https://stackoverflow.com/questions/45554887/azure-logic-app-how-to-make-a-x-www-form-encoded make sure you’ve structured your body like that. – Skin Mar 06 '23 at 21:05

1 Answers1

0

I agree with @Skin and also after reproducing from my end, I could get this working in postman using application/x-www-form-urlencoded Content-Type. I have implemented the same in logic apps too which gave me the desired results. Below is the body that I have used in my logic app.

grant_type=client_credentials
&client_id=<CLIENT_ID>
&client_secret=<CLIENT_SECRET>
&username=<USER_NAME>
&password=<PASSWORD>

In postman:

enter image description here

In Logic Apps:

enter image description here

SwethaKandikonda
  • 7,513
  • 2
  • 4
  • 18
  • Hi Swetha, What if your password is something like: 7J(&F6w'Btd!Nt I know this works on Postman, can you try on Logic App to see if the API works with password as this? – Vivek KB Mar 07 '23 at 12:35
  • I have my username same as client id and password same as client secret. Can you try same as mentioned? – SwethaKandikonda Mar 07 '23 at 12:47
  • The API details are not created by me, I'm connecting to a source. I would want to know if this issue is because of the password and hence I requested if you can give it try with password as this so we at least know if this is the issue or not – Vivek KB Mar 07 '23 at 12:50
  • @VivekKB Have you tried changing the body as mentioned above? – SwethaKandikonda Mar 08 '23 at 08:23