开发者

how to keep authentication to post to twitter api?

Along side my existing user database, I have been storing a relation of twitter user_ids. I currently use this to allow users to login to their account using twitter via their oauth api

However, I would now like to utilise this account link to allow the users开发者_开发知识库 to post updates from my site to twitter when they are logged into their account on my site. Please note, that users don't have to log in using twitter, but do require a twitter account linked in order to post to twitter automatically.

So, the question is, what do I need to store to ensure that my site has permanant update access to the user's twitter account without them needing to re-login to twitter. Upon the initial setup, they must allow my app permision (so i'm not doing anything wrong).

Thanks!


The user will always have to give permission, so it will always be redirected once to twitter to give it.

However, once this has been done, you can request an access token, which should give you permanent access to the account of the user, of course until withdrawn by the user through twitter.com

You will be using oAuth to do this. Previously it was also possible (maybe still, but deprecated) to login to twitter remotely with a username/password combination.

take a close look to the oAuth documentation of twitter: https://dev.twitter.com/docs/api#oauth

There are some twitter libraries available, also for PHP, to help you with this: https://dev.twitter.com/docs/twitter-libraries#php

Always make sure you store the tokens which are provided by twitter once granted access. With these tokens you can access the users twitter account.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜