ios-sdk icon indicating copy to clipboard operation
ios-sdk copied to clipboard

Used to be able to auth with player, now no longer can.

Open markd2 opened this issue 1 year ago • 7 comments

My app has been working well until today. I do authorizeAndPlayURI, the Spotify app comes forward, shows an "X", returns to my app, but did not authorize. I get these two errors. The Spotify app is installed, and it does play music. There are no complaints in the developer console. There is no email communication from the developer program saying we've been delisted. Happens with the Spotify app prior to the March 4 update, as well as that version.

AppRemote: Failed connection attempt with error: Error Domain=com.spotify.app-remote.transport Code=-2000 "Stream error." UserInfo={NSLocalizedDescription=Stream error., NSUnderlyingError=0x2829a6bb0 {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.}

2024-03-20-14:20:33.54-AppDelegate.swift:58 - 2055 - spotify didFailConnectionAttemptWithError Optional(Error Domain=com.spotify.app-remote Code=-1000 "Connection attempt failed." UserInfo={NSLocalizedDescription=Connection attempt failed., NSUnderlyingError=0x2829a6a00 {Error Domain=com.spotify.app-remote.transport Code=-2000 "Stream error." UserInfo={NSLocalizedDescription=Stream error., NSUnderlyingError=0x2829a6bb0 {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.}}, NSLocalizedRecoverySuggestion=Ensure the Spotify app is installed, and try to reconnect., NSLocalizedFailureReason=Could not connect to the Spotify app.})

Thanks! ++md

markd2 avatar Mar 20 '24 18:03 markd2

Upon looking through the issue list from the Spotify forum, it appears that the URI redirect was suddenly no longer accepted today: https://community.spotify.com/t5/Spotify-for-Developers/User-Authorization-failing-in-production/m-p/5956550

According to this issue (posted 37 minutes ago as of writing), the word spotify must be added, so it appears as "yourappname://spotify"

I am honestly quite hazy on this whole redirect URI thing, but perhaps it could be helpful to you to figuring out a solution.

To be sure, I would imagine that when your app redirects to open the Spotify app, you see briefly a "X" flash before redirecting back to your app?

zallanx avatar Mar 20 '24 23:03 zallanx

awesome! I'll go take a look and see if that fixes it for me. (and I wonder if this new restriction was communicated somewhere...)

markd2 avatar Mar 20 '24 23:03 markd2

Nowhere as far as I am aware of. These things tend to just happen suddenly and everyone is left scrambling.

zallanx avatar Mar 20 '24 23:03 zallanx

Can confirm, I just updated my prod apps, and by adding spotify to my redirect URI so that it goes from myappname:// to myappname://spotify solves the issue.

I am also refreshing the tokens via a backend, and note that if you are using config variables, you must also update it to myappname://spotify as well

Hope this helps.

zallanx avatar Mar 20 '24 23:03 zallanx

Adding spotify helped me. How did you know that it should help?

litvakle avatar Mar 21 '24 09:03 litvakle

@litvakle There was a post about this issue on the Spotify forums (https://community.spotify.com/t5/Spotify-for-Developers/User-Authorization-failing-in-production/m-p/5956550) and the person noted in passing about a redirect URI featuring spotify appended at the end of their original URI

Edit: specifically, the person noted

We've already added a new RedirectURI mixonset://spotify although it seems not to have taken effect yet.

That was my hint to append spotify at the end of the original URI.

zallanx avatar Mar 21 '24 12:03 zallanx

I'd love to recommend adding Spotify to our clients, but breaking changes like this make the company feel more like a fly-by-night startup than an established enterprise. :( Hopefully they'll learn from this and announce/migrate changes like this in the future.

romoore avatar May 08 '24 14:05 romoore