Loading credentials (website post to twitter)

May 14, 2011 at 4:06 PM
Edited May 14, 2011 at 4:07 PM

 

Hi Joe,

  I was trying to use your postonly.aspx under the examples as a walkthrough for making a simple post to twitter from the text box.  But for some reason its keeps denying me and its trying to post to my account and not the sites account.

This is what i did.

I put  all the credientials in my webconfig and referenced them like this.

     ConsumerKey = ConfigurationManager.AppSettings["twitterConsumerKey"],
                    ConsumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"],
                    OAuthToken = ConfigurationManager.AppSettings["OAuthTokenKey"],
                    AccessToken = ConfigurationManager.AppSettings["AccessToken"]

In the WebAuth then I passed the Auth when I updated the status to post auth cept its trying to post to my user account and not the account i put the credientials in for.

I read the post called a very basic concept where you said you need to read the credientials object and load them.

I even did it twice just to make sure it wasnt me. I double checked the tokens and secret so i know thats correct.

The error flys on the twitter update status.  401 rejected because Im not trying to post to mbhahn account. Do i need to supply the username and PW for the account im using as well as the tokens?

   twitterctx = new TwitterContext(auth);
            twitterctx.UpdateStatus(TextBox1.Text + " testing @mbhahn");
            TextBox1.Text = string.Empty;

 

Im going to reload the examples and step through them again see if I missed anything.  I need to figure out why the token dance likes me and not the credentials i supplied

 

May 14, 2011 at 5:23 PM

even tho i cant get this im going to change my approach. If i expose the twitter account to everyone without signing in I might get exposed to spam and people flooding the posts. I will probably use the signin example and then let them post an update with their own account name.   Ill leave up. I still would like to know if it is possible to do.

May 16, 2011 at 9:03 PM

While this isnt  anything to do with this post title. I didnt want to hog the another new thread,


I  was finally able to get a the webform sample to load. 90 percent of the time it wont because developer express and studio dont like each other. One you have have multiple projects and source safe etc.

The only time before i got it to work was to upload it. But i cant test against it very well so i was lost. Thats why most of my posts past few weeks i didnt do authenication. I created my layout first (which will probably change again)

I spent a good 30 minutes doing a step in and following the code. I think i learned more doing that then reading tons of snippets on the forum that belong to random apps.

I do have a few legitimate api concerns.  One thing the documentation lacks or i having found yet is the classes inside.

Signin authorizer class calls signing in

Memorycredentials calls storing of credentials in the memory from  IOAuthcredentials or am i backwards.

web authorizer is for web  (still looking at)

mvcauth is for mvc (will investigate further when better MVC3 materials come out)

so you know where im going with this.   I would love to see the differences in some of the library objects so i dont use the wrong ones to do some of the things.  Certain parts of the library doing different versions of the dance.  Some are obvious.

I think i just answered my self ... nevermind.

This library is the best because the documentation for those calls are listed where others there are no samples to api calls.  Just the oauth dance inner workings could use a primer. if the samples are all we need then disregard, I am happy.

 

 

I was ready to go insane most of my issues were from MS rather then the linqtotwitter api itself. 

I spent the entire day yesterday learning webforms 4.1 entity forms tutorial to decide today that if i were to store to a db the tokens i would be wasting my time since im not  having that type of model.  If i were to do something like rating of a tweet I could simply store that to a db.

So I am going to use the signin example to store the info cookies/sessions etc. (still investigating) and then what i need to do (let users post,show other twitter stuff, etc) elsewhere.

Everytime i post here i learn something even when i dont get a response. I came leaps and bounds since i started,

Thank you

your work is appreciated.

 

(btw I did buy your linq book)

 

Coordinator
May 16, 2011 at 11:08 PM

Good to hear you're moving forward.  I agree, there needs to be more documentation on the OAuth implementation.  Slowly getting there.

Joe