firebase / firebase/firebase-admin-node

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

オープン
#2,215 コメント 9 件 リアクション 9 件 担当者 0 名 GitHub で見る
api: auth
主要言語
TypeScript
スター
1.7k
フォーク
419
平均マージ
3日 10時間
マージ済み PR(30日)
16

説明

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"
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。