简体   繁体   中英

How can I get a OAuth2.0 access token only by my server?(I have my username/passward)

I'm reading about Weibo API.( Weibo means microblogging. Basiclly, it's a copycat of Twitter ).
But, I'm so confused by their API doc, thus I come to looking for help.

Here is the thing:
I want to create a application to my PHP server be able to get a tweet list or something else of my account, then my server can analyze them, and do opportune operation automatically.
But, it's need a OAuth2.0 authentication. I have no idea about how to make my server act as a application user in the authentication process.

Basically, you want your app to act as a client to Twitter, and to your own server as well.

From what I can understand, you need to know how to get the tweets from twitter's server. What you need to do is - Integrate the Twitter OAuth flow in your app. What happens is -

Register your app with twitter - get a client ID and secret, and specify a redirect_uri.

i) You make a call to the twitter's login page. (Must be provided with the SDK, Facebook's OAuth SDK provides a FB.login() call)
ii) As a user, you provide your credentials to the twitter windows. Twitter will verify the credentials and send an (Access token + Refresh token) pair to the redirect_uri that you had provided them while registering.
iii) You can fetch this access token and call Twitter's API with the access token. (The access token contains info of the user who's tweets would be fetched) - Now again I haven't used twitter's OAuth so i'm not sure what their exact endpoint is.

You should go through OAuth documentation, things would be much more clear then.

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