cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Boerresen
Advocate I
Advocate I

Obtain JWT token with Power Automate HTTP

Hi all,

 

I am trying to estaablish a flow that interfaces the Perdoo API (https://api-docs.perdoo.com/)

 

I can make the flow work from a browser, but I cannot figure out how to specify correctly the email and password required to obtain the token (https://api-eu.perdoo.com/api-token-auth)

 

Using the HTTP step

- Method: POST

- URI: https://api-eu.perdoo.com/api-token-auth

- Header: 

-- Content-Type: application/vnd.api+json

 

I've tried specifying credentials using basic authorisation, but below fault is returned independently of whether I do that or not.

 

Where I think it goes wrong is how to specify the body. 

 

The fault returned is:  

"{"errors":{"email":["This field is required."],"password":["This field is required."]}}"

 

Any help is appreciated 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
DmitriiKubyshev
Microsoft
Microsoft

Based on examples in their docs, try one of these:

1. Content-type: application/vnd.api+json

Body:

{
"data": {
"type": "obtainJwtToken",
"id": null,
"attributes": {
"email": "xxxx@xxx",
"password": "xxx"
}
}
}

 

2. Or set

Content-Type: application/x-www-form-urlencoded

Body: email=myuser%40test.com&password=xxx

View solution in original post

6 REPLIES 6
abm
Super User III
Super User III

Hi @Boerresen 

 

Try this in your HTTP Body

 

image.png



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

Thanks, but then it immidiately returns "Enter valid JSON"

 

Other ideas?

 

Screenshot 2020-11-03 091026.jpg

abm
Super User III
Super User III

Hi @Boerresen 

 

Try with the double quotes around the email and password

 

{

"email":"xxxx",
"password":"dddd"
}

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

Thanks! That solved the immediate parsing error, but now I get this error:

 

{"errors":[{"detail":"Received document does not contain primary data","status":"400","source":{"pointer":"/data"},"code":"parse_error"}]}

 

Any ideas are most welcome!

DmitriiKubyshev
Microsoft
Microsoft

Based on examples in their docs, try one of these:

1. Content-type: application/vnd.api+json

Body:

{
"data": {
"type": "obtainJwtToken",
"id": null,
"attributes": {
"email": "xxxx@xxx",
"password": "xxx"
}
}
}

 

2. Or set

Content-Type: application/x-www-form-urlencoded

Body: email=myuser%40test.com&password=xxx

View solution in original post

That worked - Thanks all that contributed!

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (75,490)