Giter Club home page Giter Club logo

Comments (2)

SimonHoiberg avatar SimonHoiberg commented on May 24, 2024

Hi @j4p 👋
Thank you for creating this issue.

Twitter has an unfortunate error response saying that you're not authorized, while in fact, it's like not to be the case.
Most likely there's a problem with how the encoding/decoding works internally.

It's a bug on our side - we will investigate 😊

Thank you.

from twitter-api-client.

j4p avatar j4p commented on May 24, 2024

Hi @SimonHoiberg
Thank you for your response!

Please do not worry too much since I believe this is not a bug in your code but rather simply an incompetence on my end.

First, allow me to explain to you the bot that I am trying to make.
Basically, the bot works by tweeting whatever is sent to it through the DM.
I made the bot with Twitter Account Activity API using the help of Twitter Autohook.
I followed this particular tutorial of which the whole code can be found here.
Everything was great, I only needed to modify the DM response part with a tweet instead.
However, as you might have known, the tweet API endpoint receives query params instead of a JSON object.
Here, I decided to use this client so that I don't have to deal with OAuth signing etc.

So everything went great, but then I decided to implement a feature such that it can also tweet the media attached to the DM.
This is where I am stuck. I managed to retrieve the media URL, however I am not authorized to access it.
Do keep in mind that I am not using the client in this part yet (I only use it for tweeting and plan to use it to upload the attached media later).
I tried making a GET request to the URL with Postman + Authorization header and it worked.
I might be able to do it with the node-fetch module but, again, I don't want to deal with OAuth signing.

So my question is:

  • Can I make a GET request to fetch the image using this client so that I don't have to deal with OAuth signing, or
  • Can I somehow get myself in an "authorized session" using this client so that I can fetch and upload the media right away, or
  • Is there a better way to do what I am trying to achieve (maybe like directly upload the attached media from media URL or media ID using this client)

Afterthoughts
Upon writing this comment I looked back into the full code from the tutorial and decided that I need to look into the Request module.
I avoided using it because it says that it is deprecated.
I will report back to you later on whether it works or not.

Thanks!

from twitter-api-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.