1

I am trying to call http request using OAuth, but I didn't find a way to create OAuth header to add it to the request.

I used to create new header(signature(RSA SHA1), nonce and timestamp) for each request but I receive unauthorized message every time. HMAC SHA1 is widely used but I didn't find a single example for RSA SHA1.

I tried the following solutions using OAuth.DotNetCore library:

OAuthRequest client= OAuthRequest.ForProtectedResource("GET", settings.ConsumerKey, 
settings.key, oauth_token, oauth_secret, OAuth.OAuthSignatureMethod.RsaSha1);
client.RequestUrl = "https://example.com/rest/api/2/user?username=jdoe";
var auth = client.GetAuthorizationHeader();
    
  using (var httpClient = new HttpClient())
  {
   httpClient.DefaultRequestHeaders.Authorization =
   new AuthenticationHeaderValue("OAuth", auth.Remove(0, 6));  
   string result =  httpClient.GetStringAsync("https://example.com
    /rest/api/2/user?username=jdoe").Result;
   }

Exception Error : RSA SHA1 is only implemented in .NET standard

My project is built using .net framework 4.6.2

fowif39074
  • 11
  • 1
  • Check the method followed in this question: [enter link description here](https://stackoverflow.com/questions/67263966/oauth1-0-authentication-says-invalid-signature-provided-signature-does-not-ma) – Danial Sa'adati Jun 19 '21 at 10:04
  • this HMAC and not rsa – fowif39074 Jun 19 '21 at 10:19
  • @DanialSa'adati how you were able to access the api through just consumer key and consumer secret key ? this can't be possible, where are access token and token secret key ? – fowif39074 Jun 19 '21 at 10:30

0 Answers0