I want to create an API to call for debugging purposes during development. Currently I have to set a breakpoint in my Android app to collect a valid bearer token to use for testing purposes. Clearly this is a pain and I was wondering what is the best route to go when calling my Auth0 API.
Here is the code I’ve tried but for whatever reason it doesn’t like the bearer token I get back.
var client = new RestClient($"https://{_options.Domain}/oauth/ro");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", $"{{\"grant_type\":\"password\",\"client_id\": \"{_options.ClientId}\",\"client_secret\": \"{_options.ClientSecret}\",\"audience\": \"{_options.ApiIdentifier}\", \"username\": \"matthew.vincent.hartz+1@gmail.com\", \"password\": \"Password1\", \"connection\": \"Username-Password-Authentication\", \"scope\": \"openid\"}}", ParameterType.RequestBody);
//request.AddParameter("application/json", $"{{\"grant_type\":\"password\",\"client_id\": \"{_options.ClientId}\",\"client_secret\": \"{_options.ClientSecret}\",\"audience\": \"{_options.ApiIdentifier}\", \"username\": \"email\", \"password\": \"password\", \"connection\": \"Username-Password-Authentication\", \"scope\": \"openid\"}}", ParameterType.RequestBody);
var response = client.ExecuteAsync(request, s =>
{
Console.WriteLine("hello");
});
return Ok();