How do I get the AccessToken&SecretToken without using username/password(callback)?


#1

Hi,

I am trying to get the Twitter Access Token & Secret Access Token from an already authenticated user ( facebook logged in ) on my site.
The user already authorized my app once and I have his permission to read/write his tweets.

So now the user is logged in via facebook and I would like to fetch his associated twitter access token via his user_id without that he has to go through the whole oauth auth flow.

Is there an API function like : Twitter->getAccessToken($TwitterID)? Similiar to Facebooks API?
I don´t want the user to be redirected to Twitterslandinpage and type in his/her password/username once again.

Thank you very much for help!


#2

No, there’s no means for you to re-obtain an access token for a user that’s granted your application access. If you didn’t persist the values, you’ll need to re-obtain them. You may find the oauth/authenticate flow is better for you here though, as it will perform a redirect without prompting if the user is logged in and has already approved your application.


#3

Thanks.
Are Twitter AcessTokens persistent? So if yes, that means I have to save his/her AccessToken and SecretToken inside my database, correct?

The https://dev.twitter.com/docs/api/1/get/oauth/authenticate function still requires username/password.

For Example using the Facebook API, I am able to just retrieve the the AcessToken by using facebook->getAccessToken($FacebookID), if the user has already gave permission to my app.


#4

They are persistent until the user explicitly revokes them.

oauth/authenticate requires the user to enter their username and password only if a session isn’t already present in the web browser AND the user doesn’t have an active relationship with the application.


#5

Thanks,again.

Ok then it seems that the only way to get them is to save them in my database. :slight_smile:


#6

How to set callback URL? The localhost didn’t work.
I download a php and java libraries.
And change the properties.
And change callback URL to http://localhost or http://127.0.0.1, both didn’t work.
Can you tell me the reason?
Thank you very much!


#7

Hi,
how can i get user’s access token and access token secret programmatically??..please help me…
thanks in advance


#8

Dear Chandu!
You can find in on google search


#9

Can you authenticate without prompting on android? Specifically in the case that the user is logged in the official twitter application for android.