react-native-spotify-remote: Getting AUTHENTICATION_SERVICE_UNAVAILABLE when calling authorize.
Hello, I am trying to get a React Native application working with this library. I previously had gotten authentication with Spotify to work when just using React Native App Auth on its own, but figured that if I’m going to be using this library to control Spotify in the background I should probably do the authentication with this as well.
However, when I call the authorize method of auth from an Android emulator I get the following:
backend.js:32 Possible Unhandled Promise Rejection (id: 1):
Error: AUTHENTICATION_SERVICE_UNAVAILABLE
Error: AUTHENTICATION_SERVICE_UNAVAILABLE
at promiseMethodWrapper (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2220:36)
at Object.SpotifyAuth.authorize (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:158119:14)
at AppContextProvider.authenticate (http://10.0.2.2:8081/components/AppContext.bundle?platform=android&dev=true&minify=false&modulesOnly=true&runModule=false&shallow=true:265:40)
at http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:176031:7
at Object.onPress (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:176123:16)
at onPress (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:55751:27)
at Pressability._performTransitionSideEffects (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:56376:15)
at Pressability._receiveSignal (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:56314:16)
at onResponderRelease (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:56232:20)
at Object.invokeGuardedCallbackImpl (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:8899:16
The login screen for Spotify does not open, and only the first print statement comes through here:
// Initialize the session
console.log("send authorization request");
SpotifyAuth.authorize(config).then(newSession => {
console.log("receive new session");
SpotifyRemote.connect(newSession.accessToken);
this.setState((state) => ({
...state,
token: newSession.accessToken
}));
console.log(newSession.accessToken);
});
I tried to look through the code for this library to see what might be causing this, but couldn’t find anywhere that would throw this error within SpotifyAuth.ts. Do you have any idea what might be wrong in my configuration/code that would be causing this? I couldn’t find anything similar online.
Thank you.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 25 (7 by maintainers)
Thank you very much all, you saved me a lot of time ! 🙏
It was still raising the AUTHENTICATION_SERVICE_UNAVAILABLE error on Android only, even with the “Android Packages” section well filled in my Spotify app’s dashboard, until I gave a try, few days ago, to write my SHA-1 fingerprints uppercase (as it is shown in the placeholder) instead of lowercase, and it did the trick.
So, fill your SHA-1 fingerprints 👉 uppercase 👈 in the Android Packages section of your Spotify app.
@thomasdelobel wow thank you so much for this. The all caps thing was my issue 😐 Owe you a beer 🍺
Same problem, I solved it after adding “Android packages” to the spotify dashboard