Forum Xamarin.Forms

Getting "Remote server returned an error: (403) forbidden" on Twitter auth using OAuth1Authenticator

ashiishtashiisht INMember ✭✭

//Twitter with OAuth1
var auth = new OAuth1Authenticator(
consumerKey: "using twitter Consumer API keys",
consumerSecret: "using twitter Consumer API secret keys",
requestTokenUrl: new Uri("https://api.twitter.com/oauth/request_token"),
authorizeUrl: new Uri("https://api.twitter.com/oauth/authorize"),
accessTokenUrl: new Uri("https://api.twitter.com/oauth/access_token"),
callbackUrl: new Uri("http://www.website.com.")
);

            auth.AllowCancel = true;
            // auth.ShowUIErrors = false;
            // If authorization succeeds or is canceled, .Completed will be fired.
            auth.Completed += (s, eventArgs) =>
            {
                // We presented the UI, so it's up to us to dismiss it.
                if (eventArgs.IsAuthenticated)
                {
                    //Utilities.userDetailsTW = new UserDetailsTW();
                    //Utilities.userDetailsTW.Token = eventArgs.Account.Properties["oauth_token"];
                    //Utilities.userDetailsTW.TokenSecret = eventArgs.Account.Properties["oauth_token_secret"];
                    //Utilities.userDetailsTW.TwitterId = eventArgs.Account.Properties["user_id"];
                    //Utilities.userDetailsTW.Name = eventArgs.Account.Properties["screen_name"];
                    //AccountStore.Create().Save(eventArgs.Account, "Twitter");
                }
                else    
                {
                    Console.WriteLine("failed");
                }
            };

Answers

Sign In or Register to comment.