spotify / ios-sdk

Spotify SDK for iOS
https://developer.spotify.com/documentation/ios/
661 stars 188 forks source link

Universal links not working for redirect URI when session type is .default #192

Open fotiDim opened 4 years ago

fotiDim commented 4 years ago

I noticed that there is a .default option apart from .clientOnly for sessionManager.initiateSession(). I would like to know what exactly it is supposed to do. In the inline documentation it says:

Authorize using a suitable method.
If Spotify is installed the app will be used instead of a web view

However AFAIK this SDK it useless without the Spotify app so how come authentication can be done using a web view?

I tried switching the SPTLoginSampleAppSwift sample app to .default but authentication never succeeds if the Spotify app is not installed. If it is indeed installed, it will have the exact same behaviour as .clientOnly so I wonder then what the purpose for it is.

fotiDim commented 4 years ago

On further inspection, this seems like a bug report. If my redirect url is a universal link (https) then the underlying ASWebAuthenticationSession window never closes. Instead I am redirected to the webpage of my https url.

It seems that ASWebAuthenticationSession is misconfigured in the SDK.

fotiDim commented 4 years ago

On even further inspection 😅 it seems that this is an issue with ASWebAuthenticationSession. It just doesn't accept https:// callback URLs. I also found this entry in open radar.

It would be nice if somebody can confirm this and then we can close this issue since there is nothing that can be done about it.

The paradox is that when Spotify is installed https:// redirect URIs can be used just fine. Redirection works as expected. However when Spotify is not installed ASWebAuthenticationSession kicks in and it requires a custom URL scheme 👎 Perhaps we could document this in the ReadMe so other devs know what to expect.

maxblanch commented 4 years ago

@fotiDim I can confirm that I have the same issue here. I never get callbacks if I use .default on initiateSession() so I'm using .clientOnly and it works fine. I haven't dig the problem so far but maybe it can confirm that this is a real issue.