firebase / firebase/firebase-js-sdk

Feature: Add arbitrary headers to each request to the emulator

Open
#5,024 1 comment 0 reactions 0 assignees View on GitHub
feature request testing-sdk
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### [REQUIRED] Describe your environment

* Operating System version: Fedora release 34 (Thirty Four)
* Browser version: Brave Browser 91.1.25.68
* Firebase SDK version: 7.24.0
* Firebase Product: emulator

### [REQUIRED] Describe the problem

#### Steps to reproduce:
1. Run the firebase emulator with auth enabled on a remote machine. Expose ports 9099, 4000, 4500.
2. Protect the endpoint with cloudflare access, and make it accessible only by certain users of an organization.
3. A client that is also protected with cloudflare access, once authenticated by cloudflare is unable to call the auth endpoint because it does not forward headers, i.e `cf-access-token`.
4. The request errors out with a CORS issue (which is most likely on cloudflares end)
5. Request: Add an optional `headers` object to the emulator initialization on the web sdk. Which would apply the headers for each request that goes out from the client.
#### Relevant Code:

```javascript
firebaseAuth.useEmulator('https://zzz.com')
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.