firebase / firebase/firebase-admin-java

Firebase Auth Emulator interferes with Firebase Storage

Đang mở
#769 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
api: auth
Ngôn ngữ chính
Java
Star
620
Fork
305
Merge trung bình
3 giờ 23 phút
Pull request đã merge (30 ngày)
1

Mô tả

### [READ] Step 1: Are you in the right place?

* For issues or feature requests related to __the code in this repository__
file a Github issue.
* If this is a __feature request__ make sure the issue title starts with "FR:".
* For general technical questions, post a question on [StackOverflow](http://stackoverflow.com/)
with the firebase tag.
* For general Firebase discussion, use the [firebase-talk](https://groups.google.com/forum/#!forum/firebase-talk)
google group.
* For help troubleshooting your application that does not fall under one
of the above categories, reach out to the personalized
[Firebase support channel](https://firebase.google.com/support/).

### [REQUIRED] Step 2: Describe your environment

* Operating System version: Windows 11
* Firebase SDK version: ____
* Library version: 9.1.1
* Firebase Product: auth, storage

### [REQUIRED] Step 3: Describe the problem

We access the Auth and Storage services in our project using this Java Admin SDK.
Recently, we wanted to make use of the Auth Emulator for development purposes. However, after enabling the emulator by setting the `FIREBASE_AUTH_EMULATOR_HOST` environment variable, the Storage calls stop working and return 401 Unauthorized.

It seems that by setting the `FIREBASE_AUTH_EMULATOR_HOST` environment variable, the [whole project enters an emulator mode](https://github.com/firebase/firebase-admin-java/blob/e8ec68c97929972acdbe05b79b5ea18f077a08a2/src/main/java/com/google/firebase/auth/internal/Utils.java#L27) and [uses emulator credentials](https://github.com/firebase/firebase-admin-java/blob/master/src/main/java/com/google/firebase/ImplFirebaseTrampolines.java#L47). The emulator credentials should be made to only apply to Auth calls.

Furthermore, I could not even find a way to create two instances of FirebaseApps (one with the emulator enabled and one disabled), since the check for `FIREBASE_AUTH_EMULATOR_HOST` is static and shared program-wide.

#### Steps to reproduce:

Use Auth and Storage in a production project. Enable `FIREBASE_AUTH_EMULATOR_HOST` and Storage stops working.

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

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

Hướng nghiên cứu

Bắt đầu bằng cách đọc src/main/java/com/google/firebase/auth/internal/Utils.java và src/main/java/com/google/firebase/ImplFirebaseTrampolines.java, đặc biệt là phần xử lý FIREBASE_AUTH_EMULATOR_HOST và thông tin xác thực của emulator. Tái hiện sự cố khi Auth và Storage được bật cùng nhau, sau đó xác minh rằng các lệnh gọi đến Storage vẫn được cấp quyền trong khi thông tin xác thực của emulator chỉ được áp dụng cho Auth; đồng thời kiểm tra xem các thực thể FirebaseApp riêng biệt có thể khác nhau về cấu hình emulator hay không.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
authentication, backend
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

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.