public static void CreateAndSetCredentials(string pinCode)
        {
            var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pinCode, _authenticationContext);

            Auth.SetCredentials(userCredentials);
            SaveCredentials(userCredentials);
        }
Example #2
0
        // GET: ValidateTwitterAuth
        public ActionResult ValidateTwitterAuth()
            {
            MyUser.VerifierCode = Request.Params.Get("oauth_verifier");
            MyUser.AuthorizationId = Request.Params.Get("authorization_id");

            if (MyUser.VerifierCode != null)
                {
                MyUser.UserCreds = AuthFlow.CreateCredentialsFromVerifierCode(MyUser.VerifierCode, MyUser.AuthorizationId) as TwitterCredentials;
                MyUser.User = Tweetinvi.User.GetAuthenticatedUser(MyUser.UserCreds) as AuthenticatedUser;

                MyUser.AuthCredentials = Auth.SetUserCredentials(MyCredentials.CONSUMER_KEY, MyCredentials.CONSUMER_SECRET, MyUser.User.Credentials.AccessToken, MyUser.User.Credentials.AccessTokenSecret) as TwitterCredentials;
                }

            Response.Redirect("~/Main/Profile");

            var _Iuser = Tweetinvi.User.GetUserFromScreenName("amit_1683");
            View_Profile vP = new View_Profile(_Iuser);
            View_Connections vC = new View_Connections(_Iuser);
            View_Keyword vK = new View_Keyword(_Iuser, "Love");
            Graph pg = new Graph(_Iuser, DateTime.Today.AddDays(-14), DateTime.Today);

            ViewBag.View_Profile = vP;
            ViewBag.View_Connections = vC;
            ViewBag.View_Keyword = vK;
            ViewBag.User = MyUser.User;
            ViewBag.ProfileGraph = pg;
            return View(ViewBag);
            }
Example #3
0
        /// <summary>Prompt the user to Authorize the MemeCannon to make tweets</summary>
        private static void UpdateUserSettings()
        {
            ITwitterCredentials appCreds = Auth.SetApplicationOnlyCredentials(twitterConsumerKey, twitterConsumerSecret);

            // This method execute the required webrequest to set the bearer Token
            Auth.InitializeApplicationOnlyCredentials(appCreds);

            // Create a new set of credentials for the application.
            TwitterCredentials appCredentials = new TwitterCredentials(twitterConsumerKey, twitterConsumerSecret);

            IAuthenticationContext authenticationContext = AuthFlow.InitAuthentication(appCredentials);
            ProcessStartInfo       psi = new ProcessStartInfo(authenticationContext.AuthorizationURL)
            {
                UseShellExecute = true,
                Verb            = "open"
            };

            // Causes a WebBrowser to open and the user needs to OK app access
            Process.Start(psi);

            // Ask the user to enter the pin code given by Twitter
            Console.WriteLine("Enter PIN Code given by Twitter to continue:");
            string pinCode = Console.ReadLine();

            // With this pin code it is now possible to get the credentials back from Twitter
            ITwitterCredentials userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pinCode, authenticationContext);

            // Save off the accessToken and accessTokenSecret
            Program.CannonCfg.AccessToken       = userCredentials.AccessToken;
            Program.CannonCfg.AccessTokenSecret = userCredentials.AccessTokenSecret;

            FileHelper.WriteJSONToFile("./CannonConfig.json", Program.CannonCfg.ToJson());
        }
        public static ITwitterCredentials AuthorizeAndGetCredentials(SecureString consumerKey, SecureString consumerSecret)
        {
            string consumerKeyStr    = consumerKey.AsString();
            string consumerSecretStr = consumerSecret.AsString();

            if (consumerKeyStr.Length != 25)
            {
                // Consumer key length check
                Console.WriteLine("Consumer key is not 25 characters long.");

                return(null);
            }

            if (consumerSecretStr.Length != 50)
            {
                // Consumer secret key length check
                Console.WriteLine("Consumer secret is not 50 characters long.");

                return(null);
            }

            Console.WriteLine("Initiating PIN authentiation with given application consumer key/secret...");

            var    auth = AuthFlow.InitAuthentication(new ConsumerCredentials(consumerKeyStr, consumerSecretStr));
            string pinNumber;

            if (OpenUrl(auth.AuthorizationURL))
            {
                Console.WriteLine("Your web browser will be opened and navigate to Twitter app authentication page.");
                Console.WriteLine($"  If not opened, manually open an web browser and navigate to: {auth.AuthorizationURL}\n");
            }
            else
            {
                Console.WriteLine($"Opening URL failed! You can manually open an web browser and navigate to: {auth.AuthorizationURL}\n");
            }

            Console.WriteLine("After logged in, the page will provide 7-character PIN numbers.");
            do
            {
                Console.Write("Please enter the correct PIN numbers here: ");
                pinNumber = Console.ReadLine();
            } while(!(pinNumber.Length == 7 && int.TryParse(pinNumber, out _)));

            Console.WriteLine("\nGetting credential...\n");

            ITwitterCredentials credential = AuthFlow.CreateCredentialsFromVerifierCode(pinNumber, auth);

            if (credential != null && !string.IsNullOrEmpty(credential.AccessToken) && !string.IsNullOrEmpty(credential.AccessTokenSecret))
            {
                Console.WriteLine("Got credential successfully");

                return(credential);
            }
            else
            {
                Console.WriteLine("Null credential. Something's wrong while getting credential.");

                return(null);
            }
        }
Example #5
0
        public ITwitterCredentials GetTwitterCredentials()
        {
            // Create a new set of credentials for the application.
            var appCredentials = new TwitterCredentials(_twitterDevApiSettings.ConsumerKey, _twitterDevApiSettings.ConsumerSecret);

            // Init the authentication process and store the related `AuthenticationContext`.
            var authenticationContext = AuthFlow.InitAuthentication(appCredentials);

            // Go to the URL so that Twitter authenticates the user and gives him a PIN code.
            var window = new TwitterOauth(authenticationContext.AuthorizationURL);

            window.ShowDialog();

            if (string.IsNullOrWhiteSpace(window.Code))
            {
                throw new Exception("User didn't succeed login");
            }

            // With this pin code it is now possible to get the credentials back from Twitter
            var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(window.Code, authenticationContext);

            return(userCredentials);


            // Use the user credentials in your application
            //Auth.SetCredentials(userCredentials);
        }
Example #6
0
        //Use your consumerKey and ConsumerSecret


        private async void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(pinText.Text))
            {
                var msgDialog = new MessageDialog("Please Enter the pin showed below");
                await msgDialog.ShowAsync();
            }
            else
            {
                var pinCode         = pinText.Text.Trim();
                var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pinCode, authenticationContext);
                Auth.SetCredentials(userCredentials);

                var vault = new PasswordVault();
                vault.Add(new PasswordCredential("Friend", "TwitterAccessToken", userCredentials.AccessToken));
                vault.Add(new PasswordCredential("Friend", "TwitterAccessTokenSecret", userCredentials.AccessTokenSecret));
                var localSettings = ApplicationData.Current.LocalSettings;
                var frame         = Window.Current.Content as Frame;

                if (localSettings.Values.ContainsKey("FirstTimeRunComplete"))
                {
                    frame?.Navigate(typeof(MainPage));
                }
                else
                {
                    frame?.Navigate(typeof(FirstTimeTutorial));
                }
            }
        }
Example #7
0
        private void button_activate_Click(object sender, EventArgs e)
        {
            button_activate.Enabled = false;
            var newCredentials = AuthFlow.CreateCredentialsFromVerifierCode(textbox_usertoken.Text, authenticationContext);

            Log.Http("Access Token = {0}", newCredentials.AccessToken);
            Log.Http("Access Token Secret = {0}", newCredentials.AccessTokenSecret);

            string consumerKey    = textbox_consumertoken.Text;
            string consumerSecret = textbox_consumersecret.Text;
            string accessToken    = newCredentials.AccessToken;
            string accessSecret   = newCredentials.AccessTokenSecret;

            var parser = new INIParser("Globals.ini");

            parser.SetValue("Authenticate", "ConsumerKey", consumerKey);
            parser.SetValue("Authenticate", "CconsumerSecret", consumerSecret);
            parser.SetValue("Authenticate", "AccessToken", accessToken);
            parser.SetValue("Authenticate", "AccessSecret", accessSecret);
            parser.Save( );

            Globals.Instance.Initialize(consumerKey, consumerSecret, accessToken, accessSecret);

            Result = true;

            this.Close( );
        }
Example #8
0
        private void buttonGettoken_Click(object sender, EventArgs e)
        {
            if (textBoxTwittertoken.Text.Length == 7)
            {
                try {
                    Program.lr2helper.userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(textBoxTwittertoken.Text, Program.lr2helper.authenticationContext);
                    Auth.SetCredentials(Program.lr2helper.userCredentials);
                    Program.lr2helper.authenticatedUser = User.GetAuthenticatedUser();
                    if (Convert.ToInt64(Program.lr2helper.authenticatedUser.IdStr) > 0)
                    {
                        buttonGettwittertoken.Enabled  = false;
                        buttonOpentwittertoken.Enabled = false;
                        textBoxTwittertoken.Enabled    = false;
                        //buttonTweetsend.Enabled = true;
                        buttonOpentwittertoken.Text = "Login Sucess";
                        textBoxTwittertoken.Text    = "@" + Program.lr2helper.authenticatedUser.ScreenName;

                        //세팅값 저장
                        XmlDocument setting_update = new XmlDocument();
                        setting_update.Load(@Program.lr2helper.setting_path);
                        setting_update.GetElementsByTagName("auth_key")[0].InnerText    = Program.lr2helper.userCredentials.AccessToken;
                        setting_update.GetElementsByTagName("auth_secret")[0].InnerText = Program.lr2helper.userCredentials.AccessTokenSecret;
                        setting_update.Save(@Program.lr2helper.setting_path);
                    }
                } catch (Exception err) {
                    Program.lr2helper.WriteLog(err.ToString());
                }
            }
        }
Example #9
0
        public void Autorize()
        {
            SettingsWorker settingsWorker = new SettingsWorker("Settings.ini");

            settingsWorker.LoadSettings();

            Auth.SetUserCredentials(settingsWorker.settings.consumerKey,
                                    settingsWorker.settings.consumerSecret,
                                    settingsWorker.settings.userAccessToken,
                                    settingsWorker.settings.userAccessSecret);

            if (User.GetAuthenticatedUser() == null) //invalid Credentials
            {
                try
                {
                    var appCredentials = new Tweetinvi.Models.TwitterCredentials(
                        settingsWorker.settings.consumerKey,
                        settingsWorker.settings.consumerSecret);
                    var authenticationContext = AuthFlow.InitAuthentication(appCredentials);
                    Process.Start(authenticationContext.AuthorizationURL);
                    var pinCode        = Console.ReadLine();
                    var newCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pinCode, authenticationContext);
                    Auth.SetCredentials(newCredentials);
                    settingsWorker.settings.userAccessToken  = newCredentials.AccessToken;
                    settingsWorker.settings.userAccessSecret = newCredentials.AccessTokenSecret;
                    settingsWorker.SaveSettings();
                }
                catch
                {
                    throw new Exception("Autorization Failed!");
                }
            }
        }
Example #10
0
        public async Task <ActionResult> TwitterCallback(string oauth_token, string oauth_verifier, string authorization_id)
        {
            var context = HttpContext.GetOwinContext().Get <ApplicationDbContext>();
            // Create the user credentials
            var userCreds = AuthFlow.CreateCredentialsFromVerifierCode(oauth_verifier, authorization_id);

            // Do whatever you want with the user now!
            var twitterUser = Tweetinvi.User.GetAuthenticatedUser(userCreds);

            ViewBag.User = twitterUser;
            //search for registered user by their twitter id
            var registeredUser = context.Users.SingleOrDefault(x => x.TwitterId == twitterUser.Id);

            if (registeredUser != null)
            {
                await SignInManager.SignInAsync(registeredUser, false, false);
            }
            else
            {
                var user = new ApplicationUser {
                    Email = twitterUser.Email, UserName = twitterUser.Email
                };
                user.TwitterId = twitterUser.Id;
                var createResult = await UserManager.CreateAsync(user);

                await SignInManager.SignInAsync(user, false, false);
            }

            return(View());
        }
Example #11
0
        public ITwitterCredentials confirmAuthFlow(string pinCode)
        {
            var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pinCode, authenticationContext);

            File.WriteAllText(path, new JavaScriptSerializer().Serialize(HetzerCredential.fromTwitterCredentials(userCredentials)));
            return(userCredentials);
        }
Example #12
0
        public static Tuple <bool, IAuthenticatedUser> SetCredentialsWithPin(IAuthenticationContext context, string pin, bool applicationWide = true)
        {
            var userCreds = AuthFlow.CreateCredentialsFromVerifierCode(pin, context);

            if (userCreds != null)
            {
                var authedUser = User.GetAuthenticatedUser(userCreds);
                if (applicationWide)
                {
                    Auth.ApplicationCredentials = userCreds;

                    if (Auth.ApplicationCredentials.AccessToken == userCreds.AccessToken &&
                        Auth.ApplicationCredentials.AccessTokenSecret == userCreds.AccessTokenSecret)
                    {
                        return(Tuple.Create(true, authedUser));
                    }
                }
                else
                {
                    Auth.Credentials = userCreds;

                    if (Auth.Credentials.AccessToken == userCreds.AccessToken &&
                        Auth.Credentials.AccessTokenSecret == userCreds.AccessTokenSecret)
                    {
                        return(Tuple.Create(true, authedUser));
                    }
                }
            }

            return(Tuple.Create <bool, IAuthenticatedUser>(false, null));
        }
Example #13
0
        public Token CreateTokenFromPin(string pin)
        {
            var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pin, authenticationContext);

            return(new Token {
                Key = userCredentials.AccessToken, Secret = userCredentials.AccessTokenSecret
            });
        }
    public String sendTweet(String NewTweet)
    {
        var userCreds = AuthFlow.CreateCredentialsFromVerifierCode(Session["verifierCode"], Container.authorizationId);
        var user      = Tweetinvi.User.GetAuthenticatedUser(userCreds);

        user.PublishTweet(NewTweet);
        return("sent!");
    }
Example #15
0
        public async Task <ActionResult> ValidateTwitterAuth(string oauth_verifier, string authorization_id)
        {
            ITwitterCredentials userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(oauth_verifier, authorization_id);

            await SetAuthCookie(userCredentials);

            return(View(_tweetinviService.ValidateTwitterAuth()));
        }
Example #16
0
        private void EnteredPin(string pin)
        {
            var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pin, authContext);

            Auth.SetCredentials(userCredentials);

            CreateUserCredentialsFile(userCredentials.AccessToken, userCredentials.AccessTokenSecret);
        }
Example #17
0
        public TwitterCredentials ActivatePIN(string pin)
        {
            TwitterCredentials = (TwitterCredentials)AuthFlow.CreateCredentialsFromVerifierCode(pin, AuthenticationContext);
            Auth.SetCredentials(TwitterCredentials);

            SetTwitterTokens(TwitterCredentials.AccessToken, TwitterCredentials.AccessTokenSecret, false);

            return(TwitterCredentials);
        }
Example #18
0
        private void Authorize(string AuthCode)
        {
            var UserCredentials = AuthFlow.CreateCredentialsFromVerifierCode(AuthCode, AuthenticationContext);

            Auth.SetCredentials(UserCredentials);
            var AuthenticatedUser = Tweetinvi.User.GetAuthenticatedUser();

            Console.WriteLine("Connected to Twitter");
        }
Example #19
0
        public void FinishUserAuthentication(string pinCode)
        {
            // With this pin code it is now possible to get the credentials back from Twitter
            var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pinCode, authenticationContext);

            // Use the user credentials in your application
            Auth.SetCredentials(userCredentials);
            m_authorized = true;
            //FullTwitterSample();
        }
Example #20
0
        private void continueLogin()
        {
            var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(textPin.Text, authenticationContext);

            Auth.SetCredentials(userCredentials);
            registry.Write("consumerSecret", userCredentials.ConsumerSecret);
            registry.Write("accessSecret", userCredentials.AccessTokenSecret);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Example #21
0
        public TwitterApiCredentials ValidateTwitterAuth(string authId, string verifierCode)
        {
            var credentials = AuthFlow.CreateCredentialsFromVerifierCode(verifierCode, authId);

            return(new TwitterApiCredentials
            {
                AccessToken = credentials.AccessToken,
                AccessTokenSecret = credentials.AccessTokenSecret
            });
        }
Example #22
0
        public async Task <IActionResult> ValidateAuth()
        {
            // 認証後のリダイレクトURLにパラメータがついているのでそれを保持
            if (!(Request.Query.ContainsKey("oauth_verifier") && Request.Query.ContainsKey("authorization_id")))
            {
                return(this.RedirectToAction("Login"));
            }

            var verifierCode    = Request.Query["oauth_verifier"];
            var authorizationId = Request.Query["authorization_id"];

            // 承認IDと検証者コードから資格情報を取得
            var userCreds = AuthFlow.CreateCredentialsFromVerifierCode(verifierCode, authorizationId);
            var user      = Tweetinvi.User.GetAuthenticatedUser(userCreds);

            // セッションに資格情報を保持
            this.HttpContext.Session.Put("UserCreds", userCreds);

            var claims = new List <Claim>
            {
                new Claim(ClaimTypes.Name, user.Name),
                new Claim("FullName", user.ScreenName),
                new Claim(ClaimTypes.Role, "Administrator"),
                new Claim(ClaimTypes.UserData, JsonConvert.SerializeObject(userCreds)),   // 資格情報をクレーム
            };

            var claimsIdentity = new ClaimsIdentity(
                claims, CookieAuthenticationDefaults.AuthenticationScheme);

            var authProperties = new AuthenticationProperties
            {
                //AllowRefresh = <bool>,
                // Refreshing the authentication session should be allowed.

                // 認証クッキーの有効時間。CookieAuthenticationOptions.ExpireTimeSpan をオーバーライドする
                ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(15),

                // false の場合はブラウザを閉じた時点でクッキーは消える
                IsPersistent = true,

                //IssuedUtc = <DateTimeOffset>,
                // The time at which the authentication ticket was issued.

                //RedirectUri = <string>
                // The full path or absolute URI to be used as an http
                // redirect response value.
            };

            await HttpContext.SignInAsync(
                CookieAuthenticationDefaults.AuthenticationScheme,
                new ClaimsPrincipal(claimsIdentity),
                authProperties);

            return(RedirectToAction("Index", "Home"));
        }
Example #23
0
        /// <summary>
        /// 인증 과정을 거친뒤 TweetInvi 내부에 Credentials을 적용시킵니다.
        /// </summary>
        /// <param name="credentials">트위터의 자격 정보입니다.</param>
        /// <returns></returns>
        public void CredentialsCertification(TwitterCredentials credentials)
        {
            var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(credentials.PINNumber, _context);

            if (userCredentials == null)
            {
                throw new CredentialsTypeException("PINNumber가 잘못 입력되었습니다.");
            }

            Auth.SetCredentials(userCredentials);
        }
Example #24
0
        //функция авторизации в Twitter по пингоду
        public bool Auth(string pinCode)
        {
            // With this pin code it is now possible to get the credentials back from Twitter
            var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pinCode, authenticationContext);

            if (userCredentials is null)
            {
                return(false);
            }
            // Use the user credentials in your application
            Tweetinvi.Auth.SetCredentials(userCredentials);
            return(true);
        }
Example #25
0
        public void AddUser(string username, string pin)
        {
            var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pin, _authenticationContext);

            _context.TwitterUsers.Add(new TwitterUser
            {
                Username          = username,
                AccessToken       = userCredentials.AccessToken,
                AccessTokenSecret = userCredentials.AccessTokenSecret
            });

            _context.SaveChanges();
        }
Example #26
0
        private void button2_Click(object sender, EventArgs e)
        {
            var pinCode = textBox1.Text;

            // С помощью этого пин-кода теперь можно получить учетные данные из Twitter
            var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pinCode, authenticationContext);

            // Использовать учетные данные пользователя в приложении
            Auth.SetCredentials(userCredentials);
            Form1 form = new Form1();

            form.Show();
            Hide();
        }
        public async Task <IActionResult> OnGetCallbackAsync(string returnUrl = null, string remoteError = null)
        {
            if (remoteError != null)
            {
                ErrorMessage = $"Error from external provider: {remoteError}";
                return(RedirectToPage("./Login"));
            }
            ExternalLoginInfo info = await _signInManager.GetExternalLoginInfoAsync();

            if (info == null)
            {
                return(RedirectToPage("./Login"));
            }

            // Sign in the user with this external login provider if the user already has a login.
            Microsoft.AspNetCore.Identity.SignInResult result = await _signInManager.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent : false, bypassTwoFactor : true);

            if (result.Succeeded)
            {
                IEnumerable <Microsoft.AspNetCore.Authentication.AuthenticationToken> tokens = info.AuthenticationTokens;
                if (Request.Query.ContainsKey("oauth_verifier") && Request.Query.ContainsKey("authorization_id"))
                {
                    string verifierCode           = Request.Query["oauth_verifier"];
                    string authorizationId        = Request.Query["authorization_id"];
                    ITwitterCredentials userCreds = AuthFlow.CreateCredentialsFromVerifierCode(verifierCode, authorizationId);
                    Auth.SetCredentials(userCreds);
                }
                _logger.LogInformation("{Name} logged in with {LoginProvider} provider.", info.Principal.Identity.Name, info.LoginProvider);
                return(LocalRedirect(Url.GetLocalUrl(returnUrl)));
            }
            if (result.IsLockedOut)
            {
                return(RedirectToPage("./Lockout"));
            }
            else
            {
                // If the user does not have an account, then ask the user to create an account.
                ReturnUrl     = returnUrl;
                LoginProvider = info.LoginProvider;
                if (info.Principal.HasClaim(c => c.Type == ClaimTypes.Email))
                {
                    Input = new InputModel
                    {
                        Email = info.Principal.FindFirstValue(ClaimTypes.Email)
                    };
                }
                return(Page());
            }
        }
Example #28
0
        public IAuthenticatedUser GetAuthenticatedUser(string oauthVerifier, string authorizationKey, string authorizationSecret)
        {
            var appCreds = new ConsumerCredentials(AppSettings.TwitterConsumerKey, AppSettings.TwitterConsumerSecret);
            var token    = new AuthenticationToken()
            {
                AuthorizationKey    = authorizationKey,
                AuthorizationSecret = authorizationSecret,
                ConsumerCredentials = appCreds
            };

            var userCredentils = AuthFlow.CreateCredentialsFromVerifierCode(oauthVerifier, token);
            var user           = User.GetAuthenticatedUser(userCredentils);

            return(user);
        }
Example #29
0
        public ActionResult ValidateTwitterAuth()
        {
            var verifierCode    = Request.Params.Get("oauth_verifier");
            var authorizationId = Request.Params.Get("authorization_id");

            if (verifierCode != null)
            {
                var userCreds = AuthFlow.CreateCredentialsFromVerifierCode(verifierCode, authorizationId);
                var user      = Tweetinvi.User.GetAuthenticatedUser(userCreds);

                ViewBag.User = user;
            }

            return(View());
        }
Example #30
0
        public ActionResult ValidateTwitterAuth()
        {
            if (Request.Query.ContainsKey("oauth_verifier") && Request.Query.ContainsKey("authorization_id"))
            {
                var verifierCode    = Request.Query["oauth_verifier"];
                var authorizationId = Request.Query["authorization_id"];

                var userCreds = AuthFlow.CreateCredentialsFromVerifierCode(verifierCode, authorizationId);
                var user      = Tweetinvi.User.GetAuthenticatedUser(userCreds);

                ViewBag.User = user;
            }

            return(View());
        }