AuthSession in Docker container not recognising login

I am running expo in a docker container and I have setup:

docker-compose.yml

version: '2'
services:
  localdev:
    build:
      context: .
      dockerfile: ./Dockerfile
    command: yarn start
    environment:
      - EXPO_ENV=localdev
      - EXPO_USERNAME
      - EXPO_PASSWORD
    ports:
      - "19000:19000"
      - "19001:19001"
    volumes:
      - ./circle-dev/:/code/circle-dev/

.env

EXPO_USERNAME=circle-dev
EXPO_PASSWORD=password123

package.json

{
  "name": "circle-dev",
  "version": "1.0.0",
  "author": "circle-dev",
  "main": "app/app.js",
  "scripts": {
    "start": "./exp-manage.sh && react-native-scripts start",
    // other scripts
  },
  "dependencies": {
     /// lots of dependencies
  },
  "devDependencies": {
    "react-native-scripts": "1.3.1"
  }
}

exp-manage.sh

exp login --non-interactive --username $EXPO_USERNAME --password $EXPO_PASSWORD

As you can see, when I start my container, docker-compose will issue the yarn start command which will call my exp-manage.sh script and login, then start the app using "react-native-scripts": "1.3.1".

When I start my container, I get the confirmation that I have logged in correctly. Then I connect to the development server through the expo client and load the app. When I try to call an AuthSession, however, I get this message:

You are not currently signed in to Expo on your development machine. As a result, the redirect URL for AuthSession will be "https://auth.expo.io/@anonymous/circle-5640e30d-5cbd-4f54-83d3-5b1c94cf5e1a". If you are using an OAuth provider that requires whitelisting redirect URLs, we recommend that you do not whitelist this URL -- instead, you should sign in to Expo to acquired a unique redirect URL. Additionally, if you do decide to publish this app using Expo, you will need to register an account to do it.

When I exec exp whoami in the container, I am told I have correctly logged in.

You need to use exp start instead of react-native-scripts. react-native-scripts is part of Create React Native App which ignores Expo user accounts.

1 Like

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