Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
# Error:
C#
{"errors":[{"message":"The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.","code":64}]}
-------------------------------------------------------------------------------------

##, <pre lang="C#">private void CheckAuthorization()
    {
        try
        {
            string oauth_consumer_key = &quot;T3iyMyxKCCrJJMBYLIuAC14rz&quot;;//&quot;hhTc2SpEXM8seEpzL14wfzJaV&quot;;
            string oauth_consumer_secret = &quot;Yqx5dQGvXo9yyVJUAYZhEYmYKoD7o509MB3fRpQAFhRVm4yJKB&quot;;//&quot;8clhs2WnVDmgjkeDLkTVS1786HnTjBEM2WKzIjVheGGPJNmgMJ&quot;;

            if (Request[&quot;oauth_token&quot;] == null)
            {
                OAuthTokenResponse reqToken = OAuthUtility.GetRequestToken(oauth_consumer_key, oauth_consumer_secret, Request.Url.AbsoluteUri);
                Response.Redirect(string.Format(&quot;https://api.twitter.com/oauth/authorize?oauth_token={0}&quot;, reqToken.Token));
                //Response.Redirect(string.Format(&quot;https://api.twitter.com/1.1/oauth/authorize?oauth_token={0}&quot;, reqToken.Token));

            }
            else
            {
                string requestToken = Request[&quot;oauth_token&quot;].ToString();
                string pin = Request[&quot;oauth_verifier&quot;].ToString();
                var tokens = OAuthUtility.GetAccessToken(oauth_consumer_key, oauth_consumer_secret, requestToken, pin);
                OAuthTokens accesstoken = new OAuthTokens()
                {
                    AccessToken = tokens.Token,
                    AccessTokenSecret = tokens.TokenSecret,
                    ConsumerKey = oauth_consumer_key,
                    ConsumerSecret = oauth_consumer_secret

                };

                byte[] photo = File.ReadAllBytes(@&quot;D:\Rajesh\img1.jpg&quot;);
                TwitterResponse&lt;TwitterStatus&gt; response = TwitterStatus.UpdateWithMedia(accesstoken, &quot;img&quot;, photo);
                if (response.Result == RequestResult.Success)
                {
                    Response.Write(&quot;This is YOUR PAGE&quot;);
                }
                else
                {
                    Response.Write(&quot;Try some other time&quot;);
                }

            }
        }

        catch (Exception ex)
        {
            throw ex;
        }
    }</pre>
Posted
Comments
ZurdoDev 18-Jan-16 8:09am    
And the error is?...
ridoy 18-Jan-16 14:24pm    
Didn't you follow the code?!
ZurdoDev 18-Jan-16 14:33pm    
No. Follow it where? To never never land?

I didn't see it before but yes, it's pretty clear.
ridoy 18-Jan-16 14:25pm    
Well your problem is self-explanatory. Use API v1.1 instead of 1.0

1 solution

As Ridoy pointed out that I am blind, and perhaps you are too ;), the error message says that Twitter does not support your code anymore. You have to update it following their documentation.
 
Share this answer
 
Comments
ridoy 19-Jan-16 3:01am    
my 5, :p
Member 10944569 19-Jan-16 21:46pm    
but how did i update it . whats the process to update . please tell us
Member 10944569 19-Jan-16 21:45pm    
but how did i update it . whats the process to update . please tell us
ZurdoDev 20-Jan-16 7:56am    
Start by going to the url in the error message. There won't be a magic bullet to do it for you, you're going to have to rewrite some of your code. There's no way around that.
Member 10944569 20-Jan-16 23:07pm    
I try it but not working.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900