abraham/twitteroauth

Have access to V2 API, but all V2 requests are forbidden

davidenco opened this issue · 7 comments

In the developer portal, my app has read/write access to my Twitter account (also showing under the Connected Apps option within my Settings).

I can call endpoints in the V1.1 API, just not the V2 API.

I've deleted the project/app and recreated them several times, each time thinking I had done something wrong or even settings things up in a different order, but to no avail.

This PHP code:

<?php
    $this->TwitterOAuth = new TwitterOAuth($config['consumer_key'], $config['consumer_secret'], $config['oauth_token'], $config['oauth_token_secret'])

    try
    {
        $this->TwitterOAuth->setApiVersion('2');
    }
    catch (TwitterOAuthException $e)
    {
        return $e->getMessage();
    }

    print_r($this->TwitterOAuth->get('tweets/'.$post_id, ['tweet.fields' => 'created_at,id,text']));
    exit();
?>

Results in the following output:

stdClass Object
(
    [client_id] => XXXXXXXX
    [detail] => When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal.
    [registration_url] => https://developer.twitter.com/en/docs/projects/overview
    [title] => Client Forbidden
    [required_enrollment] => Appropriate Level of API Access
    [reason] => client-not-enrolled
    [type] => https://api.twitter.com/2/problems/client-forbidden
)

It shows that authentication is working but Twitter is refusing to fulfill the request. You'll have to try and contact their developer support for a resolution.

I have been having issues with this account, I have tried, it was working perfectly as a day before yesterday, but after I tested again I saw this problem that I haven't been able to fix, I need help on this:

detail":"When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal.","registration_url":"https://developer.twitter.com/en/docs/projects/overview","title":"Client Forbidden","required_enrollment":"Appropriate Level of API Access","reason":"client-not-enrolled","type":"https://api.twitter.com/2/problems/client-forbidden"}

I have been having issues with this account, I have tried, it was working perfectly as a day before yesterday, but after I tested again I saw this problem that I haven't been able to fix, I need help on this:

detail":"When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal.","registration_url":"https://developer.twitter.com/en/docs/projects/overview","title":"Client Forbidden","required_enrollment":"Appropriate Level of API Access","reason":"client-not-enrolled","type":"https://api.twitter.com/2/problems/client-forbidden"}

I had the same issue today. Was working fine yesterday, but then today it was not.

In the Developer Portal, my app had been moved from the project to a standalone app, so I deleted the app fine, but when I tried deleting the project it said there was an app assigned to it so I couldn't delete the project. There was no apps assigned to the project!

So, I re-created the app under the project and tried again but to no avail. In the end, I realised I was still using the statuses/update endpoint, so I changed this to the tweets endpoint and had to set the $json parameter to true for the ->post() method, and after that it worked.

Just to add, when I had enrollment issues, I found the only fix was to delete the app and project, and re-create them from scratch. This resolved the issue. Other users on the Twitter developer forums said the same. Perhaps give that a try.

I will try this immediately, thanks

@davidenco still having same response, I deleted the project and app and create new one on developer platform, I had an endpoint that helps communicate to user twitter account, which I can then use to access user tweets etc, connection to user account has been throwing same error even after deleting the project and app and creating another one, I'm also thinking maybe spring boot library doesn't support this recent update, I'm also looking for alternatives to use if the problem is from the spring boot library.

This happened to me just now. I managed to add an existing app to the project that was lingering there. No further action was necessary.