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

Method for setting access keys/bearer token needed #46

Open Acorn221 opened 2 years ago

Acorn221 commented 2 years ago

Hi, is there a reason there's no method to set access keys / _bearerToken (along with the time they were acquired)?

I'm using the ESP-32 Deep Sleep 'RTC_DATA_ATTR' variables, and that has a limit of 8kb ram as it is persistent through deep sleep. My problem is that I would rather not refresh the access key every time the ESP-32 wakes up from deep sleep if I can avoid it, as it causes the ESP32 to draw more power and creates some unnecessary requests. I could store the whole instance of the class in the 'RTC_DATA_ATTR' ram but that might be too much for it and it's not very efficient.

I was wondering whether or not I have missed something and if this was an intentional decision, otherwise I can make a PR to add this!

witnessmenow commented 2 years ago

Hey,

I don't think there is any reason for it other I just didn't think of this use case. I think a set bearer token method makes sense. Only issue is you don't know when it expires, as the current logic around that is based on millis() which obviously won't persist across resets.

Hope this helps!

Brian On Tue 23 Aug 2022, 14:46 James Arnott, @.***> wrote:

Hi, is there a reason there's no method to set access keys / _bearerToken (along with the time they were acquired)?

I'm using the ESP-32 Deep Sleep 'RTC_DATA_ATTR' variables, and that has a limit of 8kb ram as it is persistent through deep sleep. My problem is that I would rather not refresh the access key every time the ESP-32 wakes up from deep sleep if I can avoid it, as it causes the ESP32 to draw more power and creates some unnecessary requests. I could store the whole instance of the class in the 'RTC_DATA_ATTR' ram but that might be too much for it and it's not very efficient.

I was wondering whether or not I have missed something and if this was an intentional decision, otherwise I can make a PR to add this!

— Reply to this email directly, view it on GitHub https://github.com/witnessmenow/spotify-api-arduino/issues/46, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL5PQXSFPBO67OVHLXGTW3V2TI3HANCNFSM57LR3X6A . You are receiving this because you are subscribed to this thread.Message ID: @.***>