OAuth. StatusCode: 403. SSL is required. C#


#1

Hello everyone! I need your help!

My code:

  HttpRequestMessage request = new HttpRequestMessage();
    string data = "oauth_consumer_key=\"" + oauth_consumer_key +
                   "\", oauth_nonce=\"" + oauth_nonce +
                   "\", oauth_signature=\"" + Uri.EscapeDataString(oauth_signature) +
                   "\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"" + oauth_timestamp +
                   "\", oauth_version=\"1.0\"";
    request.Headers.Authorization = new     System.Net.Http.Headers.AuthenticationHeaderValue("OAuth", data);
    request.RequestUri = new Uri(twitterRequestTokenUrl, UriKind.Absolute);

    request.Method = new HttpMethod("POST");

    var response = await httpClient.SendAsync(request);

What could be the problem, I send an inquiry:

http://api.twitter.com/oauth/request_token

and get the following answer:

StatusCode: 403, ReasonPhrase: ‘Forbidden’, Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
connection: close
date: Wed, 08 Apr 2015 09:06:50 GMT
server: tsa_b
set-cookie: guest_id=v1%3A142848401049508299; Domain=.twitter.com; Path=/; Expires=Fri, 07-Apr-2017 09:06:50 UTC
x-connection-hash: 407806cc38f466361aa7e9efb2a35601
x-response-time: 5
Content-Length: 16
content-type: text/plain; charset=utf-8
}
SSL is required


#2

Looks like you got an answer on Stack Overflow.