2016-12-28 39 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导致错误,就像你观察到的那样。