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'); } });
2 Answers
Answers 1
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.
Answers 2
It seems that your Redirect URL is configured incorrectly.
Make sure your URI is entered in the Spotify My Applications Dashboard.
Make sure your URI conforms to the following:
- All characters in the URI should be lowercase.
- Your URI’s prefix (the part before the first colon) must be unique to your application. It cannot be a general prefix like http. Your URI’s prefix must only be used by your application for authenticating Spotify. If you already have a URL scheme handled by your application for other uses, you shouldn’t recycle it.
- It’s a good convention to have the name of your application in there.
- You should also have a path component to your URI (the part after the first set of forward slashes, something like
your-app://callback
)
0 comments:
Post a Comment