react-native-spotify-remote icon indicating copy to clipboard operation
react-native-spotify-remote copied to clipboard

QUESTION: After session/token from Spotify expires, does requesting a new session/token always opens and switches to the Spotify App?

Open bumpingChris opened this issue 2 years ago • 2 comments

I would like to be able to request a new session/token from Spotify without switching to the Spotify app. This might be related to: https://github.com/cjam/react-native-spotify-remote/issues/42#issuecomment-820449988

Here are what I'm confused about:

  1. Is there a way to prevent having to always open the Spotify App? Is that what the refresh-token is for?
  2. If refresh-token / renew session is the way, it seems we have to implement/call the refresh token mechanism ourselves atm - it is not part of the example.
  3. How long a life does the refresh-token have before it expires as well?

bumpingChris avatar Jan 29 '23 17:01 bumpingChris

Hey good question. I haven't had a chance to get the refresh tokens figured out. Ideally this library could transparently refresh them and maintain the connection. I have found the iOS implementation from spotify to be challenging due to iOS backgrounding spotify after inactivity. So then the only way to wake it up is through the auth flow. That being said, if it's still awake in the background, I'm sure you could try and use the web sdk to refresh the token and then try to use this library to re-establish the connection with the new token.

Again, I haven't tried it, but that's the approach I would try first. The tokens should come back with expiry dates, but I don't recall if I was exposing all of that through this library.

cjam avatar Jan 30 '23 16:01 cjam

Hey good question. I haven't had a chance to get the refresh tokens figured out. Ideally this library could transparently refresh them and maintain the connection. I have found the iOS implementation from spotify to be challenging due to iOS backgrounding spotify after inactivity. So then the only way to wake it up is through the auth flow. That being said, if it's still awake in the background, I'm sure you could try and use the web sdk to refresh the token and then try to use this library to re-establish the connection with the new token.

Again, I haven't tried it, but that's the approach I would try first. The tokens should come back with expiry dates, but I don't recall if I was exposing all of that through this library.

@cjam Thank you for your response and your effort on this. Really appreciate it. I'll play around with trying to get the refresh to work.

bumpingChris avatar Jan 31 '23 03:01 bumpingChris