Code Monkey home page Code Monkey logo

Comments (3)

Freguglia avatar Freguglia commented on June 19, 2024

Hi @ankoure, thanks for letting me know. Did you setup your credentials using the twitch_auth() function as specified in the Authenticantion section of the README file?

You can setup an OAuth token by calling the twitch_auth() function after you setup TWITCH_CLIENT_ID and TWITCH_CLIENT_SECRET as environment variables.

from rtwitchapi.

ankoure avatar ankoure commented on June 19, 2024

I added the TWITCH_CLIENT_ID and TWITCH_CLIENT_SECRET to the r environ file, then restarted R. I used the twitch_auth() function and it ran without an error but it did not prompt anything additional. Is twitch_auth() supposed to prompt something or should I be using the auth token in the function?

from rtwitchapi.

Freguglia avatar Freguglia commented on June 19, 2024

twitch_auth() handles the authentication process automatically, so you never really have to deal with the tokens manually. What it does in the backend is:

  • a POST request to https://id.twitch.tv/oauth2/token is sent using the credentials (TWITCH_CLIENT_ID and TWITCH_CLIENT_SECRET) found in your .Renviron file.
  • an access token is then created by the Twitch API and it is sent to you in the response of the request, as described in the Client credentials flow
  • the received access token is read and passed to httr's set_config() so that it will be automatically passed as a header in future requests made by httr.
  • now any request made by the package's functions (e.g. get_streams()) is made with the token as a header.

In summary, twitch_auth() obtains the token for you and automatically adds it to every future request made by rTwitchAPI functions. If it ran without any error, then the other functions should work normally.

I think I'll add some kind of feedback in twitch_auth() so that is becomes clearer that something happened in the background and you're now able to use the other functions.

from rtwitchapi.

Related Issues (3)

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.