JoshLmao / Spotify4Unity

🎮🎵 Add the SpotifyAPI.NET library into Unity, enabling access to the Spotify Web API, allowing for control of Spotify and accessing the world of music
https://assetstore.unity.com/packages/tools/integration/spotify4unity-ui-tools-spotify-authorization-129028
MIT License
94 stars 8 forks source link

Authentication Fails after Period of Time with "Illegal Scope" Error #22

Closed HungryAnteaterCE closed 3 years ago

HungryAnteaterCE commented 4 years ago

Describe the bug I'm still not sure if this is a bug or a user error on my part. Authentication sporadically fails with an "invalid scope" error message. I believe it may be happening when the current token expires. Authentication succeeds again after attempting randomly to connect to different Client ID's/apps registered in the Spotify dashboard. Authentication will work for a while but will eventually start failing again. This issue also happens in the "all_controls" example scene included with the plugin.

My experience with web programming is very limited so I may be missing something obvious.

To Reproduce: I'm not exactly sure how to reproduce this issue, but I will describe a test I made below.

  1. For each app I registered in the Spotify Dashboard, I create a game object containing a SpotifyService component with its Client and Secret IDs set to match the app's.
  2. I create a separate test script that stores each of these objects in an array. This test script responds to keyboard input (0-9) by selecting the game object with the given index.
  3. For the selected game object, I call Connect() on the SpotifyService component attached to it.
  4. If authentication fails, "illegal scope" will pop up in a web browser tab.
  5. After pressing random numbers on the keyboard (attempting to connect to different ClientIDs), authentication will eventually succeed again and pop up a success message in a new tab.
  6. At this point, authentication will succeed for all products/client IDs for some limited period of time.

Expected behavior I need to figure out how to reauthorize my credentials in a predictable manner.

Platform: PC.

Unity Version: 2019.2.0f1

JoshLmao commented 4 years ago

This is similar to #21. Inside the Spotify4Unity service scripts, there is an advanced settings section where you can pick and choose which scopes you want. In the latest release, by default, the "Birthday" scope is selected. If you deselect it, you should get the problem solved.

HungryAnteaterCE commented 4 years ago

It looks like this fixed the issue. Thanks!