Radioh / ha_twitch_helix

Home Assistant custom component to integrate with Twitch helix api.
MIT License
21 stars 2 forks source link

Error at startup: 403 invalid client secret #3

Closed picto3000 closed 2 years ago

picto3000 commented 2 years ago

Just installed via HACS and created a client_id and generated an oauth token. Same result if I remove secrets and enter client and token directly into the config. I've tried generating a new auth with no change.

  - platform: twitch_helix
    client_id: !secret twitch_client_id
    client_secret: !secret twitch_client_secret
    own_channel_id: !secret twitch_channel_id
    channel_ids:
      - "502430815" # desertheartsrecords
      - "436417492" # PykaMusic
      - "504331394" # hotdubtimemachine
      - "408679510" # jessu
      - "535661629" # cool_guy_club
      - "646868791" # djnewgirl
      - "503461554" # thefunkhunters
      - "513403459" # ShintaLovesHouseMusic
Logger: homeassistant.components.sensor
Source: custom_components/twitch_helix/sensor.py:52 
Integration: Sensor (documentation, issues) 
First occurred: 4:53:31 PM (1 occurrences) 
Last logged: 4:53:31 PM

Error while setting up twitch_helix platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/twitch_helix/sensor.py", line 52, in setup_platform
    client = Twitch(client_id, client_secret, target_app_auth_scope=scopes)
  File "/usr/local/lib/python3.9/site-packages/twitchAPI/twitch.py", line 168, in __init__
    self.authenticate_app(target_app_auth_scope if target_app_auth_scope is not None else [])
  File "/usr/local/lib/python3.9/site-packages/twitchAPI/twitch.py", line 424, in authenticate_app
    self.__generate_app_token()
  File "/usr/local/lib/python3.9/site-packages/twitchAPI/twitch.py", line 407, in __generate_app_token
    raise TwitchAuthorizationException(f'Authentication failed with code {result.status_code} ({result.text})')
twitchAPI.types.TwitchAuthorizationException: Authentication failed with code 403 ({"status":403,"message":"invalid client secret"}
)
Radioh commented 2 years ago

Hi! I've just tried on my setup with the same config using my own secrets and it seems to work. The error message seems to indicate the client secret is wrong.

How did you setup the Twitch app?

This is an example of how mine looks like (sorry it's on Danish, but should look kinda the same): Remember to hit the "save" button at the bottom of the app.

example

picto3000 commented 2 years ago

Solved - cheers for the help. Generated a new app and this time is worked... weird.