help to get acess token & acess token secret , from username and password to users

Sep 4, 2014 at 8:35 PM
Edited Sep 4, 2014 at 8:36 PM
hi !
help me
to get acess token & acess token secret
from username and password for users
Coordinator
Sep 4, 2014 at 8:46 PM
Hi,

I'm not sure I understand your question exactly, but maybe some more information might help. Twitter uses OAuth and there are various ways for users to authorize your application, depending on the technology being used and the type of application you're building. They deprecated username/password login years ago. The closest you'll get is XAuth, which LINQ to Twitter supports, but you must still obtain permission from Twitter to use it. Here's some documentation that might help you understand OAuth and LINQ to Twitter OAuth support:

Securing Your Applications

@JoeMayo
Sep 23, 2014 at 7:23 AM
thank you so much..
i asked about .. login to twitter using linqtotwitter sdk ..
by using username and password my account in twitter !
without get PIN Number and put it in program !!
Sep 24, 2014 at 5:47 AM
i try this code :
https://linqtotwitter.codeplex.com/wikipage?title=Implementing%20XAuth&referringTitle=Learning%20to%20use%20OAuth

..
        var auth = new XAuthAuthorizer
        {
            Credentials = new XAuthCredentials
            {
                ConsumerKey = ConfigurationManager.AppSettings["twitterConsumerKey"],
                ConsumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"],
                UserName = "YourUserName",
                Password = "YourPassword"
            }

};

i add the linqtotwitter.dll !
and i faced this message
Error 1 'LinqToTwitter.XAuthAuthorizer' does not contain a definition for 'Credentials'
Coordinator
Sep 24, 2014 at 5:08 PM
Hi,

I just updated the documentation. In the latest version of LINQ to Twitter, that property name is now CredentialStore, like this:
            var auth = new XAuthAuthorizer
            {
                CredentialStore = new XAuthCredentials
                {
                    ConsumerKey = ConfigurationManager.AppSettings["consumerKey"],
                    ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"],
                    UserName = "YourUserName",
                    Password = "YourPassword"
                }
            };
Tip: You'll need permission from Twitter API before this will work.

@JoeMayo
Sep 25, 2014 at 5:46 AM
thank you ..
i try this code and don't receive anything !! and nothing happened
"i am using codes .. to c# desktop program"
        var auth1 = new PinAuthorizer()
        {
            CredentialStore = new InMemoryCredentialStore
            {
                ConsumerKey = ConfigurationManager.AppSettings[apikey],
                ConsumerSecret = ConfigurationManager.AppSettings[apisecret]
            },
            GoToTwitterAuthorization = pageLink => Process.Start(pageLink),
            GetPin = () =>
            {
                Console.WriteLine(
                    "\nAfter authorizing this application, Twitter " +
                    "will give you a 7-digit PIN Number.\n");
                Console.Write("Enter the PIN number here: ");
                return Console.ReadLine();
            }

        };
 thank you agine for help ... 
Coordinator
Sep 25, 2014 at 5:44 PM
Hi,

The downloadable source code has demos, where their project names are prefixed with Linq2TwitterDemo_. Can you get those to run? If so, try to find the difference between that and your code. If not, try to run Fiddler to see what message Twitter API is returning. Also, try wrapping the code in a try/catch block to see if you're receiving an exception for some reason.

@JoeMayo
Sep 26, 2014 at 2:47 AM
i try wrait this code .
        try { 
        apikey = keytext.Text;
        apisecret = secrettext.Text;

        var auth1 = new PinAuthorizer()
        {
            CredentialStore = new InMemoryCredentialStore
            {
                ConsumerKey = apikey,
                ConsumerSecret = apisecret
            },
            GoToTwitterAuthorization = pageLink => Process.Start(pageLink),
            GetPin = () =>
            {
                Console.WriteLine(
                    "\nAfter authorizing this application, Twitter " +
                    "will give you a 7-digit PIN Number.\n");
                Console.Write("Enter the PIN number here: ");
                return Console.ReadLine();
            }

        };
        }
        catch (Exception ec)
        {
            MessageBox.Show(ec.Message, "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

. and get nothing to !!

and i can't download the source code ..
i try and faced ..
https://www.codeplex.com/site/querystringnotvalid?ReferenceId=30765b03-0d72-4899-b31c-5b2d94fbebb4


thank you for help . .. .
Coordinator
Sep 26, 2014 at 4:27 PM
Did you call
    await auth1.AuthorizeAsync();
BTW, you can view the source code too: https://linqtotwitter.codeplex.com/SourceControl/latest#Linq2TwitterDemos_Console/Program.cs

@JoeMayo
Sep 26, 2014 at 8:31 PM
when i add the
await auth1.authorizeAsync();
i faced :
Error 1 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. j:\twitter controller\twetter controller\twetter controller\form1.cs 93 1 Twetter Controller

pleas uplode the source code to another website .. like mediafire or 4shared !
thank you so much ..