2016-12-28 65 views
0

我正在使用Auth0,我想檢索我的客戶端應用程序的所有用戶。從Auth0檢索所有用戶

下面是我的代碼:

var apiClient = new ManagementApiClient("<<Token>>", new Uri("https://<<Domain>>/api/v2/users")); 
var allClients = await apiClient.Users.GetAllAsync(); 

我使用的令牌,其中包括閱讀:在auth0用戶權限。 但我得到以下錯誤,

Path validation error: 'String does not match pattern ^.+\|.+$: users' on property id (The user_id of the user to retrieve).

我讀這arrticle,但我不理解,什麼樣的變化,我需要在auth0進行。

https://auth0.com/forum/t/auth-renewidtoken-returns-a-user-id-validation-error/1151

是什麼改變了我需要解決呢?

回答

0

您需要通過以下方式之一來創建ManagementApiClient

// Pass the base Uri of the API (notice it does not include the users path) 
var api = new ManagementApiClient("[token]", new Uri("https://[account].auth0.com/api/v2")); 

// Pass only the domain as a string 
var api = new ManagementApiClient("[token]", "[account].auth0.com")); 

你包括基本的API路徑由它來/users導致錯誤,就像你觀察到的那樣。