firebase / firebase/firebase-admin-node

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

Đang mở
#2,215 9 bình luận 9 reaction 0 người được giao Xem trên GitHub
api: auth
Ngôn ngữ chính
TypeScript
Star
1.7k
Fork
419
Merge trung bình
3 ngày 10 giờ
Pull request đã merge (30 ngày)
16

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.