Discussions

Ask a Question
Back to All

Authorization is not provided - GET Employee Data

I have created a Power Automate flow that uses a POST request with my API client-ID and secret to create a token. This is successful. (NB I have edited the token below)

{
"success": true,
"data": {
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3sdvMiOiJodHRwczovLcgh2FwaS5wZXJzb25pby5kZS92MS9hdXRoIiwiaWF0IjoxNjc4MjczMTMyLCJleHAiOjE2NzgzNTk1MzIsIm5iZiI6MTY3j,jlODI3MzEzMiwianRpIjoiNWQ1OGY5MzEtYWvvfvvvsdvsdvsdvsdvsdvsdvsdvsdvsdvsdvjLWE2YmUtYWEwMzRhMzM2MWQ3Iiwic3VvfvfdWpGbFl6WXdPVGRqWTJGbVpHVTNOR1ppT1dZNVkySXkiLsdvsdvCJwcnYiOiI3YTEm.5OTQ5OTlkMTgxZGVlYTY4ZTQzMDRiMzM0NmU3OGY4MzhlYsdvs2I3Iiwic2NvcGUiOlsiZW1w,bG95ZWVzOnJlYWQiXX0.PeqyTwaP5nwqjs1xvbJX_ihLg3Udvsdv7loLYbWa1BZG03Ts"
}
}

I then parse the JSON and extract the token to add this into the GET request.

Here is the GET:

{
"uri": "https://api.personio.de/v1/company/employees?limit=200&offset=0",
"method": "GET",
"headers": {
"accept: application/json": "",
"authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2FwaS5wZXJzb25pby5kZS9asfdsA1MSwiseanRpIjoiMWRkOsdcsdcDIxYjAtNWNhOC00MzkyLWIdxY2ItZjEafdvaxNDQ5NThhMmRkIiwic3ViIjoiWWpGbFl6WXdPVGRqWTJGbVpHVTNOR1ppT1dZNVkySXkiLCJwcnYiOiI3YdcsdcvTE5OTQ5OTlkMTgxZGVsdlYTY4ZTQzMDRiMzM0NmU3OGY4MzhlY2I3Iiwic2NvcGUiOlsiZW1wbG95ZWVzOnJlYWQiXX0.nR9OqJZGl5URr3NAVIaYoaklNZV3gv7bgxNXMHu-yYI": ""
}
}

The Response I then see is:

{
"statusCode": 401,
"headers": {
"Transfer-Encoding": "chunked",
"Connection": "keep-alive",
"vary": "Origin",
"x-frame-options": "DENY",
"content-security-policy": "frame-ancestors 'none'",
"strict-transport-security": "max-age=31536000",
"Cache-Control": "no-cache, private",
"Date": "Wed, 08 Mar 2023 10:58:52 GMT",
"WWW-Authenticate": "jwt-auth",
"Content-Type": "application/json",
"Content-Length": "80"
},
"body": {
"success": false,
"error": {
"message": "Authorization is not provided",
"code": 401
}
}
}

I can't see what is going wrong.