Not getting refreshToken when authenticating.
psoren opened this issue · 2 comments
I am using react-native 0.59.9, I am developing for iOS, and my iOS version is 12.3.1. I am testing out with the example app. The example app is working, however I am running into issues when trying to log out the Session object.
After I initialize in the example app, I run this code
let sessionInfo = await Spotify.getSessionAsync();
console.log(sessionInfo);
While I get an object with the keys for the access token, the expire time, and the scopes, the value for refresh token is null. I have also tried
Spotify.addListener('login', session => {
console.log('the session info is: ');
console.log(session);
})
and I get the same result. According to the documentation, I should be able to get the refresh token, as if I do not have a refresh token I will not be able to refresh my access token to continue to enable playback for users. Maybe I am doing something wrong here, but I do not think so. Any help would be much appreciated. Thanks!
What data are you passing to initialize
? Are you making sure to pass a tokenSwapURL
and tokenRefreshURL
?
I setup the example server on heroku with the tokenSwapURL of that server set to the tokenSwap key of the options object when initializing. It does work now and I am able to get a refreshToken. I was confused due to doing it differently with my previous experience with the Spotify API, as I thought that I automatically got a refresh token when sending the authorization code to the https://accounts.spotify.com/api/token endpoint. It works now. Thanks for the help, I will close this issue