Hello, I am developing a Web App where I use Auth0.com for user authentication and authorization. It’s working great, but I’m having a problem getting the user data. My project is Blazor Wasm and I’m using the client library for C#. In the controller the request is correct and it shows me all the fields, but when I read the results in the razor page (Client) they are null. I have no error message or anything. I honestly don’t know what else to try. I leave the methods used and images.
Library: C#
Versión: 7.12
Server side
[HttpGet("GetUsuarioByEmail")]
public async Task<ActionResult> GetUsuarioByEmail(string estudioId, string email)
{
var token = await _tokenService.GetTokenAuth0Async(estudioId);
IList<User> profile = new List<User>();
try
{
var client = new ManagementApiClient(token, _auth0Configuracion.Domain);
profile = await client.Users.GetUsersByEmailAsync(email);
return Ok(profile);
}
catch (Exception ex)
{
//Log error
return BadRequest(ex.Message);
}
}
Image of the breakpoint on return Ok(profile)
Client Side
var requestUsuario = await Http.GetAsync(url);
if (requestUsuario.IsSuccessStatusCode)
{
var lectura = await requestUsuario.Content.ReadAsStringAsync();
usuariosAuth0 = JsonConvert.DeserializeObject<List<Auth0.ManagementApi.Models.User>>(lectura);
}
else
{
errorCarga = $"Error al cargar datos del Usuario {requestUsuario.ReasonPhrase}";
}
The image of the breakpoint in usuariosAuth0
I tried it with the API, but with the same result.
Could you help me? Is there an error in the code that I’m not seeing?
Regards