Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connectToSpotifyRemote fails when providing access token #131

Open
dhcracchiolo opened this issue Aug 19, 2021 · 9 comments
Open

connectToSpotifyRemote fails when providing access token #131

dhcracchiolo opened this issue Aug 19, 2021 · 9 comments
Assignees
Labels
awaiting-clarification clarification or retesting needed iOS Specific for iOS

Comments

@dhcracchiolo
Copy link

Describe the bug
SpotifySdk.connectToSpotifyRemote fails to connect to spotify and throws several errors when I provide an access token. I know the token is valid as I just got it from a request under an hour ago. When I call connectToSpotifyRemote in the exact same place without an access token it works just fine.

To Reproduce
Steps to reproduce the behavior:

  1. call SpotifySdk.connectToSpotifyRemote and provide accessToken argument.

Expected behavior
SpotifySdk to let me reuse my access token.

Smartphone (please complete the following information):

  • Device: Iphone 8
  • OS: ios 14
@fotiDim fotiDim added the iOS Specific for iOS label Sep 24, 2021
@fotiDim fotiDim self-assigned this Oct 1, 2021
@fotiDim
Copy link
Collaborator

fotiDim commented Oct 2, 2021

@dhcracchiolo I can't reproduce your issue. Which version of the package are you using? Try using the latest from master. Would also be nice if you could provide some code that demonstrates the issue.

@fotiDim fotiDim added the awaiting-clarification clarification or retesting needed label Oct 2, 2021
@TobiWinter
Copy link

Hey I have the same problem. When i try to connect with a token i got only a few minutes before i get the following error:

AppRemote: Failed connection attempt with error: Error Domain=com.spotify.app-remote.transport Code=-2000 "Stream error." UserInfo={NSLocalizedDescription=Stream error., NSUnderlyingError=0x280d90150 {Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, NSLocalizedRecoverySuggestion=Reconnect the transport to the Spotify app., NSLocalizedFailureReason=A stream error has occured in the transport.}

@fotiDim
Copy link
Collaborator

fotiDim commented Jan 11, 2022

Hey I have the same problem. When i try to connect with a token i got only a few minutes before i get the following error:

AppRemote: Failed connection attempt with error: Error Domain=com.spotify.app-remote.transport Code=-2000 "Stream error." UserInfo={NSLocalizedDescription=Stream error., NSUnderlyingError=0x280d90150 {Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, NSLocalizedRecoverySuggestion=Reconnect the transport to the Spotify app., NSLocalizedFailureReason=A stream error has occured in the transport.}

what you are facing is most likely a native SDK issue. Does restarting the Spotify app fix the issue?

@fotiDim
Copy link
Collaborator

fotiDim commented Apr 5, 2022

Closing due to lack of feedback. If the issue persists please report back.

@fotiDim fotiDim closed this as completed Apr 5, 2022
@agalambas
Copy link

I'm having the same problem, basically If I get the access token using my api calls on the backend, instead of using your method, I can't pass the access token to "connectToSpotifyRemote" because it throws that error. And so I can't connect silently.

@fotiDim fotiDim reopened this Oct 2, 2022
@i-jared
Copy link

i-jared commented Dec 20, 2022

Hey I have the same problem. When i try to connect with a token i got only a few minutes before i get the following error:

AppRemote: Failed connection attempt with error: Error Domain=com.spotify.app-remote.transport Code=-2000 "Stream error." UserInfo={NSLocalizedDescription=Stream error., NSUnderlyingError=0x280d90150 {Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, NSLocalizedRecoverySuggestion=Reconnect the transport to the Spotify app., NSLocalizedFailureReason=A stream error has occured in the transport.}

what you are facing is most likely a native SDK issue. Does restarting the Spotify app fix the issue?

I'm also getting this error. Yes, restarting the spotify app fixes the issue. If I call SpotifySdk.getAccessToken, i redirect to the app again, and i am able to connectToSpotifyRemote again. After waiting about 30 seconds of not using the SDK, I get the following error:

AppRemote: Disconnected with error: Error Domain=com.spotify.app-remote.transport Code=-2001 "End of stream." UserInfo={NSLocalizedRecoverySuggestion=Reconnect to the Spotify app., NSLocalizedDescription=End of stream., NSLocalizedFailureReason=One of the streams has reached the end.}

any attempt to use SpotifySdk.connectToSpotifyRemote using the same access token at this point returns the following error:

AppRemote: Failed connection attempt with error: Error Domain=com.spotify.app-remote.transport Code=-2000 "Stream error." UserInfo={NSLocalizedDescription=Stream error., NSUnderlyingError=0x28096c6c0 {Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, NSLocalizedRecoverySuggestion=Reconnect the transport to the Spotify app., NSLocalizedFailureReason=A stream error has occured in the transport.}

@stanislavlysenko0912
Copy link

Any update 2024? Library a little abandoned?

@fotiDim
Copy link
Collaborator

fotiDim commented Feb 1, 2024

Did anyone ever verify that the same issue does not happen with the native iOS SDK? Until this is crosschecked and verified this cannot be considered an issue with this library. Ideally someone should submit both:

  • A minimal Flutter project that reproduces the issue
  • A minimal native iOS project that does not have the issue, using the same Spotify credentials, bundle id etc.

@ViktorKirjanov
Copy link

ViktorKirjanov commented May 29, 2024

have the same issue,

steps to reproduce:

  • got an access token(save it, we will need it in the end)

  • press pause, wait 10-30 sec and get the error:
    AppRemote: Disconnected with error: Error Domain=com.spotify.app-remote.transport Code=-2001 "End of stream." UserInfo={NSLocalizedRecoverySuggestion=Reconnect to the Spotify app., NSLocalizedDescription=End of stream., NSLocalizedFailureReason=One of the streams has reached the end.}

  • trying connectToSpotifyRemote with the same token and i get:

AppRemote: Connecting...
[] nw_path_necp_check_for_updates Failed to copy updated result (22)
[connection] nw_socket_handle_socket_event [C25.1.1:1] Socket SO_ERROR [61: Connection refused]
[connection] nw_socket_handle_socket_event [C25.1.2:1] Socket SO_ERROR [61: Connection refused]
[connection] nw_connection_get_connected_socket_block_invoke [C25] Client called nw_connection_get_connected_socket on unconnected nw_connection
TCP Conn 0x283dfc500 Failed : error 0:61 [61]
AppRemote: Failed connection attempt with error: Error Domain=com.spotify.app-remote.transport Code=-2000 "Stream error." UserInfo={NSLocalizedDescription=Stream error., NSUnderlyingError=0x2802c6190 {Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, NSLocalizedRecoverySuggestion=Reconnect the transport to the Spotify app., NSLocalizedFailureReason=A stream error has occured in the transport.}
flutter: \^[[38;5;196m┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<…>
flutter: \^[[38;5;196m│ #0   SpotifySdk._logException (package:spotify_sdk/spotify_sdk.dart:669:15)<…>
flutter: \^[[38;5;196m│ #1   SpotifySdk.connectToSpotifyRemote (package:spotify_sdk/spotify_sdk.dart:94:7)<…>
flutter: \^[[38;5;196m├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄<…>
flutter: \^[[38;5;196m│ ⛔ connectToSpotify failed with: Connection attempt failed.<…>
flutter: \^[[38;5;196m└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<…>
flutter: \^[[38;5;12m┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<…>
flutter: \^[[38;5;12m│ #0   HomeState.setStatus (package:slide/features/spotify/presentation/pages/spotify_example_page.dart:669:13)<…>
flutter: \^[[38;5;12m│ #1   HomeState.connectToSpotifyRemote (package:slide/features/spotify/presentation/pages/spotify_example_page.dart:457:7)<…>
flutter: \^[[38;5;12m├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄<…>
flutter: \^[[38;5;12m│ 09:58:18.866 (+0:07:30.158053)<…>
flutter: \^[[38;5;12m├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄<…>
flutter: \^[[38;5;12m│ 💡 -1000Connection attempt failed.<…>
flutter: \^[[38;5;12m└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<…>

However, if I use getAccessToken after the last error, disconnect, and then connectToSpotifyRemote with my previously saved access token on the first step, then it works. If you press pause again and wait for 10-30 seconds, it will disconnect with an error message again.

UPDATE:
i found something here, they have the same issue, but its native iOS
https://stackoverflow.com/questions/60060661/spotify-appremote-is-not-reconnecting-once-disconnected-in-ios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-clarification clarification or retesting needed iOS Specific for iOS
Projects
None yet
Development

No branches or pull requests

7 participants