Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-Native Spotify SDK iOS: Dismiss auth window

I have been developing a react-native application using the following module:

https://github.com/viestat/react-native-spotify

Currently, the application opens the authentication window to login to spotify. I do get a return of success but i'm confused as to how i now get rid of the window that popped up to login with. I understand it should redirect back to my application but it just stays on the same window with logout/ my account buttons.

Any ideas how i would dismiss this window on a returned success message?

SpotifyAuth.setClientID('*****','*****', ['streaming', 'playlist-read-private'], (error)=>{
          if(error){
            console.log(error);
          } else {
            console.log('success');
          }
        });

Here are my settings in xcode...

My redirect URI in Spotify app

like image 725
Tex0gen Avatar asked Apr 20 '17 02:04

Tex0gen


1 Answers

If you take a look at the code, the login screen (SpotifyLoginViewController to be exact), dismisses the screen at this line of code. According to the logic here, if the redirectURL that you've passed to the setClientID API doesn't match to the redirect URI that you defined in your Spotify developer account (see their authorization guide) - the screen will not be dismissed.

I suggest the you put a break-point in this function before it's checking the url scheme and see what's going on there. Either your account is not configured properly, or a wrong URL (or a URL which is not at the expected format by this package) is being sent to this API.

like image 134
Artal Avatar answered Oct 04 '22 00:10

Artal