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

Use token to connect. Fails

Open smironescu opened this issue 5 years ago • 8 comments

Hello @cjam

Nice project by the way. 👍 I'm migrating from Expo cause it hasn't any modules that support Spotify SDK for playing songs when clicking on track obtained from token.

I'm trying to connect to Spotify but fails (I'm receiving the token ok). Can you throw some light over here, please? Any suggestion is more than welcomed.

Screenshot 2020-04-07 at 13 49 18

smironescu avatar Apr 07 '20 15:04 smironescu

Hey sorry for the delay. You're getting the token from the web API or are you using your own token swap/ refresh server? Do you have the remote scope? I believe when you get the token through the API it requests that scope automatically.

cjam avatar Apr 10 '20 03:04 cjam

I have the same issue. I used these scopes: ['app-remote-control', 'user-follow-read']. @cjam Could you please take a look?

hienphung29 avatar Apr 13 '20 14:04 hienphung29

Hey sorry for the delay. You're getting the token from the web API or are you using your own token swap/ refresh server? Do you have the remote scope? I believe when you get the token through the API it requests that scope automatically.

Using swap/refresh (also I tried with Web API). No luck. I switched to Soundcloud API. Seems that its a bit less "pain in the ass" cause they only ask for the token in some cases and also they have songs that are "streamed" online so it's ok for my project. Thanks anyway for your time 👍

smironescu avatar Apr 13 '20 15:04 smironescu

I have the same issue. I used these scopes: ['app-remote-control', 'user-follow-read']. @cjam Could you please take a look?

Unfortunately, I'm a bit swamped on other work, so I won't be able to look into this right now. I've had no problems when using the token acquired through the library, but haven't tried acquiring one through the web API. But in theory it seems like there shouldn't be any issues. Might need to check the docs on the spotify sdk to see how they are doing this flow.

cjam avatar Apr 13 '20 16:04 cjam

You should invoke endSession() after error and try to connect again.

YozhikM avatar Apr 13 '20 19:04 YozhikM

I have the same issue. I used these scopes: ['app-remote-control', 'user-follow-read']. @cjam Could you please take a look?

Unfortunately, I'm a bit swamped on other work, so I won't be able to look into this right now. I've had no problems when using the token acquired through the library, but haven't tried acquiring one through the web API. But in theory it seems like there shouldn't be any issues. Might need to check the docs on the spotify sdk to see how they are doing this flow.

Thanks @cjam , I used the initialize method and it worked. Connecting using web-api did not work, I guess the web-api cannot generate a correct token for app-remote-control scope. It's still a bit annoying when I have to login twice: the first time for the AppRemote and second time for web-api (I need to do some query in my app). I hope this library will support sending request soon.

hienphung29 avatar Apr 14 '20 07:04 hienphung29

Hey @hienphung29, sorry for the delay. In theory, it should be possible to request a token through the web API and be able to use it to connect the remote to Spotify, but I haven't tested it thoroughly. On the other hand, something that I am doing which has been working well is requesting all of the web API scopes that you need with your call to initialize and then use the token you get back with the web API. That way you're using the Spotify app to generate you a token that can be used for both the web API and remote controlling the app itself. Hope that helps.

cjam avatar Apr 26 '20 04:04 cjam

@smironescu

https://github.com/cjam/react-native-spotify-remote/issues/104#issuecomment-819841837

codeCasa avatar Apr 14 '21 21:04 codeCasa