Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: Verifing Credentials question

$
0
0
I'm having some issue authorizing twitter on the application of mine.

Here is what my authorization code looks like
        public Uri CreateOptInUrl(string redirectUri)
        {
            var applicationCredentials = CredentialsCreator.GenerateApplicationCredentials(Settings.ApiKey, Settings.ApiSecret);
            var url = CredentialsCreator.GetAuthorizationURLForCallback(applicationCredentials, redirectUri);

            return new Uri(url);
        }
the issue comes when I return to my application and my callback code fires:
        public IExternalApp HandleOptInResponse(HttpRequestBase request, string redirectUri)
        {
            try
            {
                IExternalApp app = new ExternalApp {ExternalAppType = ExternalAppType.Twitter};

                var data = request.Params;

                var applicationCredentials = CredentialsCreator.GenerateApplicationCredentials(Settings.ApiKey, Settings.ApiSecret);

                var verifyAuth = CredentialsCreator.GetCredentialsFromVerifierCode(data["oauth_verifier"], applicationCredentials);

                var usr = Tweetinvi.User.GetLoggedUser();
                app.Uid = usr.Id;
                app.Token = verifyAuth.AccessToken;
                app.TokenSecret = verifyAuth.AccessTokenSecret;
                app.Username = usr.ScreenName;
                app.Name = usr.Name;

                return app;
            }
            catch
            {
                return null;
            }
        }
verifyAuth come back as null which usr then is null.

I'm hoping someone can help me as I already tried another 3rd party client and this is starting to anger me.

Thanks.

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>