2

I've a php application and successfully create a function to save access tokens and secrets in the database. (It's about sending specific content to their profile)

I want to show them which twitter account they linked to my application. How can I get their twitter user with access token?

Thanks for help.

dvdmn
  • 6,456
  • 7
  • 44
  • 52

2 Answers2

5

When you get the access token Twitter also returns a screen_name and user_id variables. You can use those instead of making an additional request to GET account/verify_credentials

abraham
  • 46,583
  • 10
  • 100
  • 152
  • I checked class codes and returned values but I could not get screen name, just id is available. I used users/lookup to get screen name.. $connection->get('users/lookup', array('user_id' => '###')) thanks for your help.. – dvdmn May 30 '11 at 12:31
0

Use this instead:

$credentials = $connection->get('account/verify_credentials')

and then to get username, name, and location-

$name = $credentials->name;

$username = $credentials->screen_name;

$location = $credentials->location;
Cris
  • 12,799
  • 5
  • 35
  • 50
amrendra
  • 345
  • 2
  • 12