cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HTT 401 Error: Unauthorized Dynatrace Account Management API

erh_inetum
Advisor

Hi,

I'm trying to get information from users using Dynatrace Account Management API without success.

 

Following this link https://docs.dynatrace.com/docs/dynatrace-api/basics/dynatrace-api-authentication/account-api-authen... I've created this request in Postman that generates a bearer successfully:

erh_inetum_0-1708347925622.png

But when I try to get information about the users I get HTTP 401 Unauthorized error:

erh_inetum_1-1708348427091.png

I get the same error if I lauch this request using swagger:

erh_inetum_2-1708348494989.png

Does anyone know what is missing?

 

Thanks in advance.

Regards,

Elena.

3 REPLIES 3

dannemca
DynaMight Guru
DynaMight Guru

When creating the OAuth client, you set all the required scope in UI. Then you will get the client_id, client_secret and resource.

You then use these values in your POST request to get the access_token, which is a really long string. No need to set the scopes again there.

Make sure to copy the entire string from "access_token" value in result json.

From your screenshot, seems you are copying just part of it.

Can you confirm and let us know?

 

Site Reliability Engineer @ Kyndryl

Hi @dannemca ,

Thanks for your answer.

I confirm you I'm copying the entire string (1094 characters length).

Thanks,

Elena.

Hi,

More information about this.

It's very strange. Using the same bearer, if I launch this request

curl -X 'GET' \  'https://api.dynatrace.com/sub/v2/accounts/xxxxxxxxxxxxxxxxxxx/subscriptions' \  -H 'accept: application/json' \  -H 'Authorization: Bearer MY_BEARER

to view my suscriptions, I get HTTP 200 OK but no data is returned:

erh_inetum_1-1708408944847.png

This is the scope defined:

account-idm-read account-idm-write account-env-read account-env-write account-uac-read account-uac-write iam-policies-management iam:policies:write iam:policies:read iam:bindings:write iam:bindings:read iam:effective-permissions:read app-engine:apps:run settings:objects:read settings:objects:write settings:schemas:read oauth2:clients:manage

 

Thanks.

Featured Posts