Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase: Error (auth/api-key-not-valid.-please-pass-a-valid-api-key) #2410

Open
coracoo opened this issue Nov 4, 2024 · 7 comments
Open

Comments

@coracoo
Copy link

coracoo commented Nov 4, 2024

I am using Docker for deployment,then used the JSON file downloaded from Firebase, copied the CLIENT_EMAIL and PRIVATE_KEY, but I can't log in no matter what. Is there an error in the content of the PRIVATE_KEY?

QQ_1730735646727

QQ_1730735931649

@Phoenix-Starlight
Copy link
Contributor

Your PK is not invalid, your API key is wrong.

@coracoo
Copy link
Author

coracoo commented Nov 7, 2024

but I copy all the keys from firebase , It still cant work

QQ_1730959449230

@Phoenix-Starlight
Copy link
Contributor

Is it reading from .env instead?

@coracoo
Copy link
Author

coracoo commented Nov 12, 2024

yes.Even I try to set the environment in docker-compose.yaml, but still not work

@Phoenix-Starlight
Copy link
Contributor

Can you upload the docker-compose.yaml? You can censor it.

@coracoo
Copy link
Author

coracoo commented Nov 17, 2024

Sure, Here it is, I just censor FIREBASE_PRIVATE_KEY

services:

  mongo:
    image: mongo:8.0.0-noble
    restart: always
    ports:
      - 27017:27017
    environment:
      MONGO_INITDB_ROOT_USERNAME: pokemon
      MONGO_INITDB_ROOT_PASSWORD: pokemon1234

  app:
    image: pokemonautochess
    restart: always
    ports:
      - 21000:9000
    environment:
      FIREBASE_API_KEY: "AIzaSyD7PM0W_I8Vgv6AYZzZwpmdK4cmfazp5pE"
      FIREBASE_AUTH_DOMAIN: "pokomon-auto-chess.firebaseapp.com"
      FIREBASE_PROJECT_ID: "pokomon-auto-chess"
      FIREBASE_STORAGE_BUCKET: "pokomon-auto-chess.firebasestorage.app"
      FIREBASE_MESSAGING_SENDER_ID: "27156915081"
      FIREBASE_APP_ID: "1:27156915081:web:47319132c924e3b35df758"
      FIREBASE_CLIENT_EMAIL: "firebase-adminsdk-m3iqy@pokomon-auto-chess.iam.gserviceaccount.com"
      FIREBASE_PRIVATE_KEY: "-----BEGIN PRIVATE KEY-----\nMIIs2GFE----here set private key-----6tT/FtFOq4LsT\nk8GAMXIkuxENX3W8GgcG5w==\n-----END PRIVATE KEY-----\n"
      MONGO_URI: "mongodb://pokemon:pokemon1234@mongo:27017/dev?authSource=admin"

@jasonfoknxu
Copy link

Same problem here before.
Try docker compose build to rebuild the container.
The problem for me is the container is built before the .env is created, so the container does not get the .env variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants