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

Bug in project ID Automated Google Cloud Platform Authentication (gcp-auth addon) when using end user credentials #9154

Closed
NixBiks opened this issue Sep 2, 2020 · 1 comment · Fixed by #9164
Assignees
Labels
area/provider/gcp Issues or PRs related to gcp provider kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@NixBiks
Copy link

NixBiks commented Sep 2, 2020

There seems to be an issue with the gcp-auth addon when using end user credentials.

I have logged in using gcloud auth login. Then I've started minikube using minikube start --adons=gcp-auth. Then I've deployed a container that does the following

import firebase_admin
from firebase_admin.auth import verify_id_token
app = firebase_admin.initialize_app()
verify_id_token("some-token")

which leads to the following error

firebase_admin._auth_utils.InvalidIdTokenError: Firebase ID token has incorrect "aud" (audience) claim. Expected  "
dev-plx
" but got "dev-plx". Make sure the ID token comes from the same Firebase project as the service account used to authenticate this SDK. See https://firebase.google.com/docs/auth/admin/verify-id-tokens for details on how to retrieve ID token.

A bit of investigating shows that the project ID from the authentication is wrong

> print(f"Project ID: {repr(app.project_id)}")
Project ID: 'dev-plx\n'

This was originally posted in firebase_admin python SDK

Workaround

  1. export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
  2. minikube start --adons=gcp-auth
from firebase_admin import credentials, initialize_app
from firebase_admin.auth import verify_id_token

cert = credentials.Certificate("/google-app-creds.json")
app = initialize_app(cert)
verify_id_token("some-token")
@NixBiks
Copy link
Author

NixBiks commented Sep 2, 2020

I've never worked with Go but I assume this line is what needs to be fixed, i.e. the project id needs to be trimmed.

@sharifelgamal sharifelgamal added area/provider/gcp Issues or PRs related to gcp provider kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/provider/gcp Issues or PRs related to gcp provider kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants