@logart If you are using the Python requests library, this is how you would update the headers after receiving the Bearer token to make subsequent requests to the API.
Thank you for your help. It's strange, but the program I used (Restdebugger) probably sends the wrong Authorization header. If I used curl, everything works.
DELL-Chris H
Moderator
•
9.7K Posts
0
March 20th, 2024 19:15
I believe it is going to come down to syntax, as this query is working for me while testing.
Get list of assets:
curl -k -H 'Content-Type: application/json' -H 'Authorization:Bearer <token>' https://IPADDRESS:5700/SupportAssist/api/v2/inventory/assets
Could you try comparing to it and see if there is a difference?
DELL-Chris H
Moderator
•
9.7K Posts
0
March 19th, 2024 14:39
Logart,
What I would expect would be Authorization: accesstoken, followed with the access token that you got from the first step that worked.
Let me know if this helps.
logart
1 Rookie
•
3 Posts
0
March 20th, 2024 09:44
When I use format
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c1VyTmFtZSI6ImFkbWluIiwicm9sZSI6IlNDR0FkbWlucyIsInJlcXVlc3RpbmdJUCI6IjEwLjIuNjAuMSIsImFwcE1vZGUiOiJBUFBsSUFOQ0VTIiwiYXBpVXNhZ2VNb2RlIjoiUmVzdCIsImluc3RhbmNlSUQiOiJzeVNNQ0xqb0EvMDBFVGRITXhtbDZnVDUzrHFpeVg0ZGQyMVc4Q3ZCbTY2MVlxVGEyd2JYdkdvOHVsZHdkRk5mbXR4UXJnaTVLZVJHRkdnNTNMM3I3UT09IiwidG9rZW5UeXBlIjoiQUNDRVNTIiwidXVpZCI6Ijc3MzBjMTNkLThhNzAtNDI3YS05MWI0LWYwN2JiNjU3MWZhNyIsImlhdCI6MTcxMDkyNzYyMCwiZXhwIjoxNzEwOTI5NDIwfQ.X7FwgEEZRvU1sWvMwU5aQ2F7Yz5mK0heiY-6jdGmunE
I get error "Authorisation Header is wrong!" with code SAE-080006
What is the exact format of the header.
Authorization: Bearer <token> - is not working.
HikingTrailsForFun
1 Rookie
•
19 Posts
0
March 20th, 2024 15:03
@logart If you are using the Python requests library, this is how you would update the headers after receiving the Bearer token to make subsequent requests to the API.
session.headers.update({'Authorization': 'Bearer '+response.json()['accessToken']})
Did I answer your query? Please click on ‘Mark as Accepted Answer’. ‘Thumbs up’ the posts you like!
logart
1 Rookie
•
3 Posts
1
March 21st, 2024 09:36
Thank you for your help. It's strange, but the program I used (Restdebugger) probably sends the wrong Authorization header. If I used curl, everything works.