michimani / gotwi

A library for using the Twitter API v2 in the Go language. (It is still under development).
MIT License
126 stars 26 forks source link

error when trying the sample code provided in the readme file (app not attached to project) #306

Closed devhindo closed 1 year ago

devhindo commented 1 year ago

I get this error when trying the sample code in the readme file

The Twitter API returned a Response with a status other than 2XX series. httpStatus="403 Forbidden" httpStatusCode=403 title="Client Forbidden" 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."

even though the app is attached to a project.

michimani commented 1 year ago

I too have confirmed that the same error occurs.

The cause of this is probably due to the Twitter API v2 plan.

With the Free plan, only the following three APIs are available.

https://developer.twitter.com/en/portal/products/free

That is, GET /2/users/by/username/:username used in the example in the README is no longer available.

If you want to use this API, you need to be on a Basic plan or higher.

https://developer.twitter.com/en/portal/products/basic

I am very saddened by the recent deterioration of the Twitter API.

devhindo commented 1 year ago

Thanks that made it clear. please update the sample code to include only free plan APIs for a more friendly starter guide. @michimani

michimani commented 1 year ago

I understand. I'll fix it. Thanks for the advice.

michimani commented 1 year ago

I have added a note in the README that there are restrictions based on plan. (#307)

Tonio101 commented 1 year ago

Damn.. wasted a whole day debugging this crap to find out its due to the API plan... Thanks Elon.