I am having trouble getting an access token to work in C#. I am writing an application, and I need to update an office list using the data in one of my Domo datasets.
I have created client and secret IDs and post to "https://api.domo.com/oauth/token". I have tried several grant types and included/excluded a scope. The response is always unauthorized.
StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1,…
var tokenUrl = "https://api.domo.com/oauth/token";
var values = new Dictionary<string, string>
{
{ "grant_type", "client_credentials" },
{ "scope", "data" },
{ "client_id", clientId },
{ "client_secret", clientSecret }
};
var content = new FormUrlEncodedContent(values);
HttpResponseMessage response = client.PostAsync(tokenUrl, content).Result;
if (!response.IsSuccessStatusCode)
{
throw new Exception($"Failed to get access token: {response.ReasonPhrase}");
}
I just need to read a single dataset in Domo, using C#. Or VB.net…I'll convert code if needed. I haven't had trouble using Python. But that doesn't translate to C#.