简体   繁体   中英

Twitter API: Get Access Token without sending username/password

I am having a problem obtaining the twitter users access token and secret token without sending a username and password . I would like to get the access token by just sending the twitter_id, once the user has already authenticated my application before.

So the scenario is:

A user logs into my site (using custom login), he already gave my application permission to read/write his tweets. Now I need to load this users access token and secret access token.

Database:
CustomUID : 1 , Twitter_ID: 123456.  

So Since I know CustomUID 1 is logged in, I need the access token/secret from Twitter_ID:123456.

The Problem is I can´t find an API function that would let me get the access token without being redirect to Twitter Callback function (Twitter landing page), where the user has to type in his/her username and password, once again because the Request Tokens are obtained by the URL.

How can I solve this problem? I am used to the Facebook API, where user which have already authorize my app, allow me to receive their accesstoken just bei sending getAccessToken($ID) .

Thank you very much for help!

You have to save, possibly in your DB, the OAuth token and access token after the first time the user authenticates. Then retrieve the token the next time you need to perform a query on behalf of that user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM