How to redirect back to expo app after login to Spotify with expo-auth-session

107 Views Asked by At

I'm creating an Expo app where I try to login to the Spotify Api using expo-auth-session. My whole login flow works fine on IOS but I don't get redirected back to my app on Android.

The following code is used to start the auth session.

const CLIENT_ID = ...
const REDIRECT_URI = encodeURIComponent("exp://127.0.0.1:19000");
const SPOTIFY_AUTH_URL = `https://accounts.spotify.com/authorize?client_id=${CLIENT_ID}&redirect_uri=${REDIRECT_URI}&scope=user-read-email%20user-read-currently-playing&response_type=token`;

await AuthSession.startAsync({
      authUrl: SPOTIFY_AUTH_URL,
});

My whole login flow works fine on IOS and for the main part on Android. After a successful login, the auth session screen should redirect to the application. This is what I get instead on Android:

Android Error:

enter image description here

0

There are 0 best solutions below