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.
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
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;
https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-me
This works with the latest API v2.
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.