Search code examples
c#twittertweetinvi

tweet with tweetinvi from an authenticated user


I have authenticated a user successfully

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);

        int UserID = Convert.ToInt32(Request.Params.Get("id"));

        var isUser = (from u in context.Users where "some code" select u).SingleOrDefault();

        if (isUser != null)
        {
            isUser.UserTweeterAuthorizationId = authorizationId;
            isUser.UserTweeterVerifierCode = verifierCode;

            context.SaveChanges();

            //بفرسته به ... و ادامه ماجرا
        }
        else
        {
            //بفرسته به ... با پیغام خطا
        }
    }

How can I send a tweet with this user ? I cant find any help in tweetinvi wiki on github


Solution

  • The userCreds object that you receive will contain all the information that you are looking for. Just save these information and use the Auth.SetUserCredentials with these information.

    Thanks to @Linvi