Getting OAuth 1.1 Error after specifying to use Version 2
Searching Tweets using twitteroauth works perfectly, but when requesting Twitter usage using /2/usage/tweets I keep getting an OAuth 1,1 error.
`
$connection = new TwitterOAuth($twitter_consumer_key, $twitter_consumer_secret, $twitter_access_key, $twitter_access_secret);
$connection->setApiVersion('2');
$response = $connection->get('usage/tweets');
print_r($response);
`
This returns:
`
stdClass Object
(
[title] => Unsupported Authentication
[detail] => Authenticating with OAuth 1.0a User Context is forbidden for this endpoint. Supported authentication types are [OAuth 2.0 Application-Only].
[type] => https://api.twitter.com/2/problems/unsupported-authentication
[status] => 403
)
`
I'm specifying the code to use version 2
All I want is to read how many searches I can still do in aq severly limited rate cycle on X.
关闭于 2025-11-17 1 条评论