Statuses/update 401 Unauthorized Error



I’m trying to post a message after getting oauth_token and oauth_token_secret
and postData is:
OAuth include_entities=“true”, oauth_callback=“http%3A%2F%2Flocalhost%3A3219%2Fadmin%2FAuthoriseTwitterCallback.aspx”, oauth_consumer_key=“mykey”, oauth_nonce=“6651531”, oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1519117419”, oauth_token=“mytoken”, oauth_version=“1.0”, status=“Hello”, trim_user=“true”, oauth_signature=“mysignature”

Please advise any help ?


The OAuth values should be in HTTP headers, not in the postData (body) - the only values that belong in the URL parameters from your post are include_entities, status and trim_user.

More generally, I’d strongly recommend using an API library that handles OAuth for you, as this can be complicated and confusing. What coding language are you targeting?


Hi there,
Thanks for reply.
Yes OAuth values are in HTTP header i.e.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(outUrl);
request.Method = httpMethod.POST.ToString();
request.Headers[“Authorization”] = OAuthHeaderPOST;

And I’m using c#


Have you looked at example libraries like Tweetinvi or LinqToTwitter to see how they implement this? I’m not an expert in C#.