One-Legged oAuth in C# using RestSharp

35 views Asked by At

I have been attempting to do a one-legged authentication in oAuth using RestSharp, but it has been unsuccessful. I am unsure what I am doing wrong. I know that there is no token based access for the form of oAuth I need to do, so I know I can't use Token-based access but I am unsure how to solve for that problem. Any assistance would be appreciated.

var basePath = "https://Fakebase.url";
var consumerKey = "fake consumer key";
var consumerSecret = "fake consumer secret";
var oAuth1 = OAuth1Authenticator.ForAccessToken(
    consumerKey: consumerKey,
    consumerSecret: consumerSecret,
    token: null,
    tokenSecret: null,
    OAuthSignatureMethod.HmacSha256);
var options = new RestClientOptions(basePath)
{
    Authenticator = oAuth1
};
var restClient = new RestClient(options);

var request = new RestRequest("path/to/get",Method.Get);

var response = await restClient.GetAsync(request);

Console.WriteLine(response.Content);
0

There are 0 answers