HowTo: Call an API with cookie authentication from a Logic App
By rickvdbosch
- 2 minutes read - 256 wordsCalling an API from a Logic App is pretty straightforward. You open up the Logic App Designer and add an HTTP Action. Specify the method to use and the URI you want to call and you’re good to go!
When the API you want to call uses Cookie Authentication, this seems pretty straightforward too. After all, the HTTP Action has an Authentication property you can set. However, this property doesn’t include Cookie authentication. These are the available options:
- None
- Basic
- Client Certificate
- Active Directory OAuth
- Raw
- Managed Identity
– or – - Enter custom value
The image above shows the first try to add cookie authentication in a Logic App. Unfortunately, this returns an Unauthorized. If you click the “Add new parameter” field, a little bit of magic happens which shows you this:
As you can see, the “Add new parameter” dropdown allows you to enable a checkbox that says “Cookie” that enables you to enter the HTTP cookie. You cannot enter the value straight in the dropdown, so close it down after you selected the checkbox and see a magic Cookie field appear underneath the Authentication field.
The end result looks something like this:
And that’s it! Of course you can use any cookie value. It includes options for using expressions, so you can store the cookie in for instance a variable and use it from there.
If you have any questions, leave a comment or contact me. Hope this helps!