Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

brainyprb's avatar

Does Twitter API v2 update affect the current laravel/socialite package implementation?

Twitter pushed a few updates to developer account plans and API endpoints

https://twittercommunity.com/t/announcing-new-access-tiers-for-the-twitter-api/188728
https://developer.twitter.com/en/docs/twitter-api/migrate/whats-new

Does it affect Socialite login implementation?

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?

0 likes
1 reply
LaryAI's avatar
Level 58

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.

Please or to participate in this conversation.