I am unclear on how to post to twitter using oauth. Please do not just post a link on this page for me to look at because chances are I have already seen it. I have the section where they go to twitter and approve the app and come back to my site. I then store the information in access key and access secret key in the database from the user. I can then post to twitter using curl but I am using the users username and password to post it which doesnt seem correct. But anyways the main problem with this is that it is not showing the posted from link and I am never using the access key and access secret key because I do not know where or how to use them. Any help is appreciated.
Since nobody answers, I think I'll throw in a word. Note, that I have never tried to use OAuth with twitter and everything I say is pure theory.
What you need to do after you obtained access credentials is (unsurprisingly) use them. I'd guess that consumer key used to obtain the access credentials is exactly what makes twitter add this "from" thingie. Besides, you're not supposed to even know user's username and password, if you're not the said user.
I think you may want to re-visit this page, even if you've been there already. These examples do give you a picture. I doubt though you can update using pure curl
.
I've done OAuth, but not from PHP, so I can't tell you the exact code to use, but I can tell you that, at this point
I can then post to twitter using curl but I am using the users username and password to post it which doesnt seem correct.
you are indeed doing it wrong. The reason it's not appearing on Twitter as being from your application is because you're submitting the status update using password-based authentication, which does not provide any (verifiable) information regarding the application which is sending the update.
When the user grants access via OAuth, Twitter will return them to your designated callback URL and send you a verifier token as part of that redirect. Once you have the verifier token, you send it back to Twitter along with your application's consumer key (thus proving that the user did in fact arrive back at your application) and Twitter will send you back an access token. The access token can then be used (along with your consumer key) to post status updates to the user's account (assuming, of course, that your application is registered for read/write access rather than read-only).
If you are using OAuth authorization, you never need the user's password. For anything. That's kind of the whole point.
I made a sign in with twitter app, but I used EpiTwitter, it's a php class that simplifies the whole oauth process, not just signing in but also updating, following, getting a user's friends etc.
Here is a link just in case you have not heard of it.
http://github.com/jmathai/twitter-async/tree/1185dc839ecee8b0cf4355994977e43e00e08185
I've read something but actually I haven't yet made it, but I'm sure you can't use user and password: oauth was made exactly to avoid storing users' credentials on third sites. When you recevive token and secrets after the first step of authentication on twitter site, you have to store those data and use them to authenticate the api calls.
I think that you can't make the first step with curl, but after the first step, when you already have token and secret stored in your db, you can use curl that calls twitter's api without browser passing stored token and secrets togheter with your calls.
When you post via OAuth to Twitter, it automatically sets your application as the Source (i.e. the "From" value)
Hi, I have recently blogged a couple of examples using ASP.NET C#, the twitter api and oAuth;
http://www.lordyz.co.uk/tag/twitter/
Hope you find them useful. Please leave comments and follow me on twitter (chrislord) if you do.
Cheers
Chris