witnessmenow / spotify-api-arduino

Arduino library for integrating with the Spotify Web-API (Does not play music)
MIT License
178 stars 33 forks source link

Super long access token #66

Open ZaleAnderson opened 7 months ago

ZaleAnderson commented 7 months ago

22:06:48.440 -> Free Heap: 209044 22:06:48.440 -> getting currently playing song: 22:06:48.440 -> /v1/me/player/currently-playing?additional_types=episode&market=US 22:06:48.440 -> stack size -1070511967 22:06:48.440 -> Refresh of the Access token is due, doing that now. 22:06:48.440 -> grant_type=refresh_token&refresh_token (hidden) 22:06:48.440 -> stack size -1070511455 22:06:48.440 -> accounts.spotify.com 22:06:49.044 -> Status: HTTP/1.0 200 OK 22:06:49.044 -> HTTP Version: HTTP/1.0 22:06:49.044 -> Status Code: 200 22:06:49.044 -> status Code200 22:06:49.044 -> No JSON error, dealing with response 22:06:49.044 -> Problem with access_token (too long or null): 582 character token was here 22:06:49.652 -> Failed to send request 22:06:49.652 -> Status Code: -2 22:06:49.652 -> stack size -1070511967 22:06:49.652 -> Error: -2

This is what my output looks like. Code worked fine until a few days ago, ran the token refresh but that was broke. Updated library and still didn't fix the issue. Used a different program to get the refresh token and now the output is what I get. It's trying to use an absurdly long 582 character access token

witnessmenow commented 7 months ago

I'll have to take a look at this over the weekend, what program did you use to get the refresh token? Did it have the same privileges as would be needed for this library (just wondering if more privileges leads to a longer access token)

ZaleAnderson commented 7 months ago

I used this repo ran locally. I tried it with all privilages and just the ones deemed necessary in your repo's readme. They both prompted the above error. Thanks for your hard work!

witnessmenow commented 7 months ago

It seems like the json parses ok, so if you just change this variable to be 600, it should work

https://github.com/witnessmenow/spotify-api-arduino/blob/main/src/SpotifyArduino.h#L87

ZaleAnderson commented 7 months ago

Thank you! This fixed my issue. I did try out the refreshtoken example just to see if it was fixed and all is well!