logart

updated

2 months ago

L

logart

1 Rookie

•

3 Posts

0

228

March 19th, 2024 09:10

Correct Authorization header for request

I got a successful response to the request to create an accessToken. I want to make another request for devices and I will add the Authorization header with the accessToken value to this request.
Unfortunately, SCG returns me the response "Authorization Header is wrong" with code SAE-080006.
What is the correct format for the Authorisation header?

  • DELL-Chris H

    7 Practitioner

    •

    9682 Posts

    •

    48046 Points

    0

    0

    Posted 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

    Social Media and Communities Professional

    Dell Technologies | Enterprise Support Services

    #IWork4Dell

    Did I answer your query? Please click on ‘Mark as Accepted Answer’. ‘Thumbs up’ the posts you like!

  • DELL-Chris H

    7 Practitioner

    •

    9682 Posts

    •

    48046 Points

    0

    0

    Posted 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.

     

     

    DELL-Chris H

    Social Media and Communities Professional

    Dell Technologies | Enterprise Support Services

    #IWork4Dell

    Did I answer your query? Please click on ‘Mark as Accepted Answer’. ‘Thumbs up’ the posts you like!

  • logart

    1 Rookie

    •

    3 Posts

    0

    0

    Posted 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

    0

    Posted 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

    0

    1

    Posted 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.