Giter VIP home page Giter VIP logo

Comments (6)

jonnybergdahl avatar jonnybergdahl commented on June 2, 2024

Some more details, since this stops working after some time I would expect authentication to be the main issue.

HA is handling the OAuth handshake itself, since it needs to keep track of the current token, so using client.auto_refresh_auth = False.
Problem is that the call doesn't fail, but just return without the total field present. I would have expected some kind of authentication error exception.

from pytwitchapi.

Teekeks avatar Teekeks commented on June 2, 2024

hm that should still raise an exception, thanks for the further investigation!

from pytwitchapi.

jonnybergdahl avatar jonnybergdahl commented on June 2, 2024

It gets more strange. I changed the code to actually refresh the token when it expired and I still get the same error.
I get this at startup.

2024-03-09 00:23:40.582 DEBUG (MainThread) [homeassistant.components.twitch.sensor] Token: {'access_token': 'whr8pbvgcy61jupn0harp5aqd02eh3', 'expires_in': 15759, 'refresh_token': 'f56blnott4u856pwlay1sxrvxbsdlu9vg5v7mn4olhf0cnkz0d', 'scope': ['user:read:follows', 'user:read:subscriptions'], 'token_type': 'bearer', 'expires_at': 1709954343.5376744}

Couple of hours later the log shows the above problem, with this auth, so it did indeed do a token refresh.

2024-03-09 00:29:38.069 DEBUG (MainThread) [homeassistant.components.twitch.sensor] Token: {'access_token': 'whr8pbvgcy61jupn0harp5aqd02eh3', 'expires_in': 15759, 'refresh_token': 'f56blnott4u856pwlay1sxrvxbsdlu9vg5v7mn4olhf0cnkz0d', 'scope': ['user:read:follows', 'user:read:subscriptions'], 'token_type': 'bearer', 'expires_at': 1709954343.5376744}

The log is complaining about that total error at that stage again.

I restarted Home Assistant, and the error went away. With the exact same token I used before the restart!?!?!

So not sure it even IS related to auth?

from pytwitchapi.

jonnybergdahl avatar jonnybergdahl commented on June 2, 2024

Meanwhile I have fixed the bug in Home Assistant that exposed the problem. It was indeed a token refresh bug.

from pytwitchapi.

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.