2016-10-05 74 views
1

我試圖使用auth0.net(.NET客戶端用於Auth0 API)進行身份驗證,但是,我收到Auth0.Core.Exceptions.ApiException錯誤,其中HTTP狀態碼爲NotFound (404)使用auth0.net調用身份驗證API時404獲得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(); 

這裏有什麼問題?管理API工作正常,並且ClientID是正確的。

+1

什麼'Auth0Url'變量的內容?如果您不想透露該信息,則可以省略/更改域中的租戶名稱部分。 –

+1

@João,這是非常好的問題!對我感到羞恥!它應該與管理API使用的不一樣。 – amuliar

回答

1

自己就有這個問題。

兩件事。

第一個請確保您使用的是正確的API網址。

E.g.

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

相關問題