【问题标题】:Getting a 404 when calling Authentication API using auth0.net使用 auth0.net 调用身份验证 API 时出现 404
【发布时间】:2017-02-13 12:21:55
【问题描述】:

我正在尝试使用 auth0.net(用于 Auth0 API 的 .NET 客户端)进行身份验证,但是,我收到了 Auth0.Core.Exceptions.ApiException 错误,HTTP 状态代码为 NotFound (404)

我正在使用以下代码:

var client = new AuthenticationApiClient(new Uri(Auth0Url));

var authenticationRequest = new AuthenticationRequest();
authenticationRequest.ClientId = ClientId;
authenticationRequest.Username = username;
authenticationRequest.Password = password;
authenticationRequest.Connection = "Username-Password-Authentication";

AuthenticationResponse response = null;
Task.Run(async () =>
{
    response = await client.AuthenticateAsync(authenticationRequest);
}).Wait();

这里有什么问题? Management API 工作正常,ClientID 是正确的。

【问题讨论】:

  • Auth0Url 变量的内容是什么?如果您不想透露,可以省略/更改域中的租户名称部分。
  • @João,这是一个非常好的问题!真丢人!它应该与用于 Management API 的不同。

标签: c# authentication auth0


【解决方案1】:

我自己也遇到了这个问题。

两件事。

首先确保您使用的是正确的 API 网址。

例如

https://<company>.au.auth0.com/api/v2

而不是 https://<company>.au.auth0.com

第二确保您使用的是基础 API

例如

https://<company>.au.auth0.com/api/v2

而不是 https://<company>.au.auth0.com/api/v2/users

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-27
    • 2018-09-22
    • 2017-01-14
    • 1970-01-01
    • 2023-03-08
    • 2016-02-28
    • 1970-01-01
    • 2022-01-12
    相关资源
    最近更新 更多