I want to run a python-script using spotipy on a headless rpi 2w with an os lite version. Because I have no browser (and cannot install it because of hardware limitations) for authorization, I use the option 'open_browser=False'.
.
.
spotify_user = os.environ.get("SPOTIPY_CLIENT_USERNAME")
spotify_scope = "playlist-modify-private,user-read-currently-playing,user-modify-
playback-state,user-read-playback-state"
oauth = SpotifyOAuth(username=spotify_user, scope=spotify_scope,open_browser=False)
user_token = oauth.get_access_token(as_dict=False)
spotify = spotipy.Spotify(auth=user_token)
Then, I run the same script on an other Computer with a browser to get the required uri and paste it on the rpi. Although the authorization on the pc with a browser succeeds, it fails on the rpi. I get an error for this line
user_token = oauth.get_access_token(as_dict=False)
spotipy.oauth2.SpotifyOauthError: error: invalid_grant, error_description: Invalid redirect URI
I wonder why that is and how I can manage it.