【问题标题】:Retrieve All Users From Auth0从 Auth0 检索所有用户
【发布时间】:2016-12-28 07:15:01
【问题描述】:

我正在使用 Auth0,并且我想检索我的客户端应用程序的所有用户。

下面是我的代码:

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

我正在使用在 auth0 中包含 Read:User 权限的令牌。 但是我遇到了错误,

路径验证错误:'字符串与模式不匹配 ^.+\|.+$: users' 属性 id(要检索的用户的 user_id)。

我阅读了这篇文章,但我不明白,我需要在 auth0 中进行哪些更改。

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

我需要做出什么改变来解决它?

【问题讨论】:

    标签: asp.net auth0


    【解决方案1】:

    您需要通过以下方式之一创建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,这将导致错误,就像您观察到的那样。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-08-29
      • 1970-01-01
      • 2016-10-28
      • 2021-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多