Using Android Autofill for signing in Spotify via Facebook closes login dialog and crashes the app
hbarylskyi opened this issue · 8 comments
After I call Spotify.login(), Spotify login dialog opens. Then I tap 'Login with Facebook'. Login dialog redirects me to facebook login page. When I start typing my credentials there, Android system suggests to use the saved password. After I tap the email/password from the popup, dialog closes itself. After that, Spotify.login() returns Promise with false
. If I call Spotify.getSession
after that, the app crashes.
export const getSpotifySession = async () => {
if (!Spotify.isInitialized()) {
await Spotify.initialize({
clientID: SPOTIFY_CLIENT_ID,
redirectURL: REDIRECT_URL,
scopes: [
'user-read-email',
'user-library-modify',
'playlist-modify-private',
'playlist-modify-public',
'user-top-read',
],
tokenSwapURL: SWAP_URL,
});
}
if (!Spotify.isLoggedIn()) {
const loggedInByUser = await Spotify.login(); // this is where the bug happens
console.log(loggedInByUser) // -> false
}
return Spotify.getSession(); // crash happens here
};
react-native: 0.61.5
rn-spotify-sdk: ^1.2.12
Try using the async method. getSessionAsync
. I know the synchronous methods tend to have issues in certain environments
@lufinkey thanks for replying. I'll try using getSessionAsync
, but isn't the problem with Spotify.login
method? Since this is the method that opens the login dialog.
Yeah I don't really know. You just said the crash was happening at getSession
so I don't see why it would be an issue with Spotify.login
if that function has already completed. Did it work, though?
If Spotify.login
is returning false
though, that means the login was cancelled
Hey @lufinkey. Just tried getSessionAsync
. Yes, it does not crash the app anymore.
But it still does not resolve the issue. The main problem is that the login dialog closes itself. Which happens on await Spotify.login();
.
p.s.: in production, our app wouldn't actually crash on await getSession
. It's not called if Spotify.login
returns false. I just noticed it while investigating the issue :)
@hbarylskyi are you still having this issue?
@lufinkey we temporarily removed Spotify from our app. You can close for now, I will let you know if I experience it again.