I'm working with twitter API and I want to implement login in my site using this API.
I did the first part and I have successfully conencted to twitter and get the authorisation token and been redirect to my callback url, but I 'm stuck there right now I don't know how to fetch profile data from this token.
Authorisation page:
After redirect I get back to my callback route:
As you can see I have received an authorisation token but I don't what to do get profile's data!!
and this is where I' stuck now:
/**
* @Route("/twitter-callback", name="front_twitter_callback")
*/
public function twitterCallbackAction(Request $request)
{
$oauth_token = $request->query->get('oauth_token');// the token
}
UPDATE:
I found a solution described here but it's not working very well, i mean I did received some info but it's the infos of the user who created the app not the connected one who who gave permission to the application to access his data.
This is what I did :
$data = $this->twitterAccesData();
// create TwitterOAuth object
$twitteroauth = new TwitterOAuth($data['key'], $data['secret'], $data['access_token'], $data['access_token_secret']);
$user = $twitteroauth->get('account/verify_credentials', $data);
die(var_dump($user)); // this always give me the same profile info no matter what user is connected!
Any help please, and thanks in advance.