univrsal / tuna

Song information plugin for obs-studio
GNU General Public License v2.0
751 stars 59 forks source link

Spotify Troubles Maintaining Authorization in Windows #152

Closed alexankitty closed 3 years ago

alexankitty commented 3 years ago

Describe the bug When putting in spotify authorization and generating tokens, the application is unable to perform a token refresh, and hitting ok or apply will cause the plugin to log out.

To Reproduce Steps to reproduce the behavior:

  1. Go to tools
  2. Click Tuna Settings
  3. Click Spotify Tab
  4. Click open login page
  5. Follow normal authorization steps to grab code
  6. Paste code into Authentication code feel
  7. Click request token - the login will be performed successfully
  8. After this, clicking OK or Apply will cause the plugin to no longer be logged in and gray out the perform refresh - clicking perform refresh will do the same thing
  9. Clicking request token again will cause the plugin to throw back a message saying the authorization code is invalid.

Expected behavior Log in to the spotify API should be maintained when saving settings or performing a token refresh (provided the refresh token isn't blocked for whatever reason)

Log https://obsproject.com/logs/qiIFyW8sX_6F1tAY

Note: the websocket disconnects can be ignored as this stems from one of my overlays.

Additional context This issue does not seem to be present in 1.5.2, however I'm unsure which version brought about this issue.

univrsal commented 3 years ago

Can you try the latest nightly build? https://github.com/univrsal/tuna/actions/runs/1248449717

alexankitty commented 3 years ago

Just tried it, same results - authorization code is being invalidated and refreshing the token isn't working. I did use the installer version if that helps any.

Edit: I tried the zip as well, and played around with it a bit. It looks like the OK and Apply buttons are no longer invalidating the login, however token refresh still seems to be b0rked.

Here's the response log = 2021.09.18 05:46 = { "access_token": "REDACTED", "expires_in": 3600, "scope": "user-modify-playback-state user-read-playback-state user-read-currently-playing", "token_type": "Bearer" }

= 2021.09.18 05:46 = { "access_token": "REDACTED", "expires_in": 3600, "scope": "user-modify-playback-state user-read-playback-state user-read-currently-playing", "token_type": "Bearer" }

= 2021.09.18 05:48 = { "error": "invalid_grant", "error_description": "Invalid authorization code" }

= 2021.09.18 05:50 = { "error": "invalid_grant", "error_description": "Invalid authorization code" }

(last two are from trying to request another token on the same code after it invalidates)

and this is showing it's no longer logged in after performing the token refresh. image

univrsal commented 3 years ago

Okay so refreshing didn't work? It should now https://github.com/univrsal/tuna/actions/runs/1248525954

alexankitty commented 3 years ago

Just tried the latest and working perfectly!

univrsal commented 3 years ago

Nice