firebase / firebase/firebase-admin-node

[firebase_auth] token issued by createCustomToken are not valid with emulated in <<demo>> project

Abierto
#2,215 9 comentarios 9 reacciones 0 asignados Ver en GitHub
api: auth
Lenguaje dominante
TypeScript
Estrellas
1.7k
Forks
419
Merge medio
3 d 10 h
PR fusionados (30 d)
16

Descripción

As per the documentation:

<< For security reasons, the Authentication emulator issues unsigned ID tokens, which are only accepted by other Firebase emulators, or the Firebase Admin SDK when [configured](https://firebase.google.com/docs/emulator-suite/connect_auth#admin_sdks). >>

So when there is an env variable `FIREBASE_AUTH_EMULATOR_HOST="127.0.0.1:9099"` firebase admin is supposed to give unsigned tokens via the emulator, which it does not:

The following:

```ts
const user = await admin.auth().createUser({ uid: randomUUID() });
const jwt = await admin.auth().createCustomToken(user.uid);
```

Results in:
```
Firebase ID token has incorrect "aud" (audience) claim. Expected "demo-test" but got "https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit"
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.