Auth0 管理 API CreateAsync 返回内部服务器错误 (500)
Auth0 management API CreateAsync returning internal server error (500)
在 Auth0 的在线管理 API 中,我可以使用此主体创建用户。但是这里 CreateAsync 无法正常工作。
private async Task CreateUserAuth0()
{
var newRequest = new Auth0.ManagementApi.Models.UserCreateRequest
{
Connection = "Username - Password - Authentication",
Email = "update2@update.com",
Password = "Test123456"
};
var response = await _managementApiClient.Users.CreateAsync(newRequest);
}
更新和删除调用工作正常。
private async Task UpdateUserEmailAuth(string email, string newEmail)
{
Auth0.ManagementApi.Models.User user = await GetUserAuth0(email);
await _managementApiClient.Users.UpdateAsync(user.UserId, new
Auth0.ManagementApi.Models.UserUpdateRequest
{
Email = newEmail
});
}
private async Task UpdateUserPasswordAuth(string email, string password)
{
Auth0.ManagementApi.Models.User user = await GetUserAuth0(email);
await _managementApiClient.Users.UpdateAsync(user.UserId, new
Auth0.ManagementApi.Models.UserUpdateRequest
{
Password = password
});
}
private async Task DeleteUserAuth0(string email)
{
Auth0.ManagementApi.Models.User user = await GetUserAuth0(email);
await _managementApiClient.Users.DeleteAsync(user.UserId);
}
删除连接中的空格属性 Username-Password-Authentication
。因为是Auth0数据库的名字,不能有空格。
另一个问题可能是密码不够强,请检查日志中Auth0的内部服务器错误以及您应用程序的密码规则。
在 Auth0 的在线管理 API 中,我可以使用此主体创建用户。但是这里 CreateAsync 无法正常工作。
private async Task CreateUserAuth0()
{
var newRequest = new Auth0.ManagementApi.Models.UserCreateRequest
{
Connection = "Username - Password - Authentication",
Email = "update2@update.com",
Password = "Test123456"
};
var response = await _managementApiClient.Users.CreateAsync(newRequest);
}
更新和删除调用工作正常。
private async Task UpdateUserEmailAuth(string email, string newEmail)
{
Auth0.ManagementApi.Models.User user = await GetUserAuth0(email);
await _managementApiClient.Users.UpdateAsync(user.UserId, new
Auth0.ManagementApi.Models.UserUpdateRequest
{
Email = newEmail
});
}
private async Task UpdateUserPasswordAuth(string email, string password)
{
Auth0.ManagementApi.Models.User user = await GetUserAuth0(email);
await _managementApiClient.Users.UpdateAsync(user.UserId, new
Auth0.ManagementApi.Models.UserUpdateRequest
{
Password = password
});
}
private async Task DeleteUserAuth0(string email)
{
Auth0.ManagementApi.Models.User user = await GetUserAuth0(email);
await _managementApiClient.Users.DeleteAsync(user.UserId);
}
删除连接中的空格属性 Username-Password-Authentication
。因为是Auth0数据库的名字,不能有空格。
另一个问题可能是密码不够强,请检查日志中Auth0的内部服务器错误以及您应用程序的密码规则。