Skip to content

I did could tweet before but not anymore "You currently have access to a subset of Twitter API v2 endpoints..." #1182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chon27 opened this issue Jun 30, 2023 · 3 comments

Comments

@chon27
Copy link

chon27 commented Jun 30, 2023

What are you attempting to do
I'm trying post a tweet

Expected behavior
I did it sometimes in the past and it was fine

Actual behavior
Now I'm getting this error:

You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you need access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/portal/product

Code example

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
$result = $connection->post("statuses/update", ["status" => $text]);

Versions:

  • TwitterOAuth: v4.0
  • PHP: v8.2.7

Additional context

@abraham
Copy link
Owner

abraham commented Jul 1, 2023

Twitter has been changing how their API is available. For support on that you'll have to ask them. https://twittercommunity.com/

You might make it work with using the v2 API

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
$connection->setApiVersion('2');
$result = $connection->post("tweets", ["text" => $text], true);

@YoannBuzenet
Copy link

Hello Abraham,
Thank you for this amazing library.
I recently switched to v2 api and can't find how to upload a media now. Would you by chance know what changed ?
Thank you!
Yoann

@mpruy
Copy link

mpruy commented Jul 31, 2023

I would like to open this topic again. I have set the api version to 2 and the endpoint to "tweets" as recommended above. I have left everything else identical to the call under API version 1.

However, I keep getting a response 401 Unauthorized.

Do I have to switch to a bearer token or does the account have to be activated for API version 2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants