AuthSession startAsync not working after publish/build

Hi,

So I’ve created an application for my master thesis in which one has to log in with a Spotify account. For this, I’ve used AuthSession. My apps works almost perfectly through expo but when I install the apk after expo build:android the first button on my login screen (which calls AuthSession.startAsync) does not work. It doesn’t do anything, not even load the browser to authenticate.

I’ve found a similar issue here, but it never got answered.

My code looks like this:

const handleSpotifyLogin = async () => {
  let results;
  const redirect_uri = AuthSession.getRedirectUrl();
  try {
    results = await AuthSession.startAsync({
      authUrl:
        "https://accounts.spotify.com/authorize?" +
        querystring.stringify({
          response_type: "code",
          client_id: env.SPOTIFY_CLIENT_ID,
          scope: env.SCOPE,
          redirect_uri,
          show_dialog: true

})
    });
  } catch (error) {
    alertError("Could not start AuthSession");
  }

And the error is shown immediately when I press the button. Any ideas on how to resolve this?
Some things I believe could be the issue, but I’m not sure how to check or fix them:

  • Something is wrong with loading the browser (Chrome permissions?)
  • My app.json is not configured correctly (but I can’t find anythin in the docs regarding this)

My app.json looks like this:

{
  "expo": {
    "name": "Mispre",
    "description": "Mispre. Spotify recommendation interface built for master thesis.",
    "slug": "mispre-thesis-app",
    "privacy": "public",
    "sdkVersion": "32.0.0",
    "platforms": [
      "android"
    ],
    "version": "1.0.4",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": false
    },
    "android": {
      "package": "cs.kuleuven.be.thesis.mispre"
    }
  }
}

Thanks in advance!

Kind regards,

Robin

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.