-
Notifications
You must be signed in to change notification settings - Fork 299
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
Add v2 API examples in README? #181
Comments
Yes, just ran into this with https://github.com/manzt/cron-tweet... Not sure if twurl supports the authentication that v2 requires. |
I am not very knowledgeable about authentication but I wrote a short article writing a nodejs twitter client that posts tweets (with media). interestingly the media upload is a v1 api and the posting is a v2 api, they said they are working on a v2 media upload api on their forums but it is fine to mix and match them in this case). I did not have to apply for any elevated access to twitter using this approach! short article here |
Thanks for sharing. I also wrote something in deno today which seems to work for the v2 endpoint: https://gist.github.com/manzt/d6cbf7f901a6e7b68c145d3820fbed7b |
Ok I figured it out! twurl /2/tweets \
--data '{"text": "Testing twurl"}' \
--header 'Content-Type: application/json' \
--consumer-key $TWITTER_API_KEY \
--consumer-secret $TWITTER_API_SECRET \
--access-token $TWITTER_ACCESS_TOKEN \
--token-secret $TWITTER_ACCESS_TOKEN_SECRET You need the content-type header in this syntax to avoid twurl url-form-encoding the data by default (like for v1.1 APIs). |
Legacy OAuth 1.0A authentication continues to work with At the moment, Over time, I would expect OAuth 1.0A to be phased out, and we prefer OAuth 2.0 for new apps (although at the current time unfortunately, the media upload functionality still uses the legacy flow). I appreciate that this is not an ideal situation at the moment! If anyone would like to fork |
Thanks for the clarification! I'm afraid I'm not knowledgeable enough about authentication to take this on at the moment. |
@andypiper is there an alternative to |
twurl /2/tweets --data '{"text": "Testing twurl"}' --header 'Content-Type: application/json' --consumer-key $TWITTER_API_KEY --consumer-secret $TWITTER_API_SECRET --access-token $TWITTER_ACCESS_TOKEN --token-secret $TWITTER_ACCESS_TOKEN_SECRET returns You must authorize first. If I add the bearer token twurl /2/tweets --data '{"text": "Testing twurl"}' --header 'Content-Type: application/json' --consumer-key $TWITTER_API_KEY --consumer-secret $TWITTER_API_SECRET --access-token $TWITTER_ACCESS_TOKEN --token-secret $TWITTER_ACCESS_TOKEN_SECRET --bearer $TWITTER_ACCESS_BEARER returns /var/lib/gems/3.1.0/gems/twurl-0.9.7/lib/twurl/oauth_client.rb:81:in
|
I was just trying to use the examples in the README but they appeared to need an elevated access
I could try to apply for this but having v2 API examples available may be useful
The text was updated successfully, but these errors were encountered: