Skip to main content

GET /api/2/users/me return 401

Thread solved
Beginner
Posts: 1
Comments: 2

Hi,

I start a PHP/Laravel module to get quota and usage. I want to get the first tenant_id, so I call /api/2/users/me

Previously, /idp/token was successiful, and give me access_token

access_token work fine (GET /versions or GET /applications give me good result) (with headers Authorization Bearer)

 

But GET /api/2/users/me give me HTTP/1.1 401 Unauthorized (["code"]=>  int(401)  ["message"]=>  string(2) "OK")

 

Why my /users/me return 401 error ? Where I can find the tenant uuid without using /users/me?

 

Thanks

0 Users found this helpful
Forum Member
Posts: 3
Comments: 73

/api/2/users/me doesn't work with tokens created with API Client.
 

The API client is not linked to a user account. Thus some API endpoints and methods are unavailable for use with API clients.

Acronis Cyber Cloud 9.0 - API changelog from that changelog
https://dl.acronis.com/u/baas/rn/API_change_log/en-US/AcronisCyberCloud…

/api/2/cleints/{client_id} -- tenant_id from JSON, assuming you create API Client for your tenant.
 

Beginner
Posts: 1
Comments: 2

Hello

Thanks for your answer

I connect with my API client created from the https://eu-cloud.acronis.com/mc/ panel (Settings->API client)
I think it was linked to my user account. (But i understand it's not true, thanks for the changelog)

 

I can't use /api/2/cleints/{client_id} because I don't know any client_id, neither any uuid/client/parent_uuid/tenant... I don't find api method like /api/2/clients/list or /api/2/tenant/list without asking those Ids

Some code example i found create API client with code, so they get client_id or tenant. But How to get those informations with already created API client ?

Thanks

 

 

 

Forum Member
Posts: 3
Comments: 73

You know client_id. It's client_id, which you've received creating an API Client. 

You use client_id as a username when you issue an authorization token.

An API Client is disconnected from an account from which it's created for security and sustainability reasons. As well we plan to have more granular permissions for API Clients itself. 

Beginner
Posts: 1
Comments: 2

Nice !

Thanks, it was simple.