The following is a code excerpt from "league/oauth1-client/src/Server/Twitter.php"
public function urlUserDetails()
{
return 'https://api.twitter.com/1.1/account/verify_credentials.json?include_email=true';
}
Does 1.1 in the above URL mean the old Twitter standard API and do we need to update it to v2 as per Twitter? will this code get depreciated any time soon? And I think v2 endpoints still do not have user email address data right? So, without user email is it worth using Twitter for login?
The current implementation of laravel/socialite package should not be affected by the Twitter API v2 update. The code excerpt provided is using the Twitter API v1.1 endpoint, which is deprecated but still functional. However, it is recommended to update the endpoint to the latest version to ensure future compatibility. The Twitter API v2 endpoints do not provide user email address data, so it is up to the developer to decide if it is worth using Twitter for login without this information.
To update the endpoint to the latest version, the following code can be used:
public function urlUserDetails()
{
return 'https://api.twitter.com/2/users/self';
}
This will return the user details for the authenticated user, including their email address if it is available.