firebase-admin-node icon indicating copy to clipboard operation
firebase-admin-node copied to clipboard

[FR]: Allow setting custom URLs (proxy) for Firebase Admin SDK services (OAuth2, AppCheck, FCM, IID, etc.)

Open okoseisback opened this issue 4 months ago • 2 comments

Is your feature request related to a problem? Please describe. We are using Firebase Admin SDK in a private network environment where direct access to Firebase services is restricted. Currently, the SDK uses fixed URLs for services like OAuth2, App Check, FCM, and IID. Because of this, we cannot route traffic through a custom proxy or internal endpoint.

For example, in our private network setup, we need to use a proxy URL to reach these services, but the SDK doesn’t provide a way to override or customize these endpoints.

Describe the solution you'd like We would like to have the ability to optionally set custom URLs for the different Firebase services used by the Admin SDK.

For instance, being able to configure a proxy URL or custom domain for: • OAuth2 (+jwks) • App Check • FCM • IID

This configuration could be done through the SDK initialization options, like:

admin.initializeApp({
  apiURLs: {
    oauth2: "https://proxy.example.com/oauth2",
    appCheck: "https://proxy.example.com/appcheck",
    fcm: "https://proxy.example.com/fcm",
    iid: "https://proxy.example.com/iid"
  }
});

This way, we can route all requests through our internal proxy without modifying the SDK code.

Describe alternatives you've considered Currently, the only alternative is to set up a network-level proxy that intercepts outgoing requests. However, this is not ideal because: • It requires additional infrastructure and maintenance. • It is harder to debug and trace traffic for each service. • It does not allow fine-grained control over different service endpoints.

Additional context This feature would greatly improve the flexibility of the SDK in environments with strict network policies. It would also make the Node.js SDK more consistent with the Go SDK’s approach, while extending the idea to cover all relevant Firebase services.

okoseisback avatar Sep 19 '25 15:09 okoseisback

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Sep 19 '25 15:09 google-oss-bot

Setting custom URIs for each services is a considerable change to the SDK design and is not something we have currently planned to implement. The SDK supports custom httpAgents that you could use to wok behind a proxy. Would that work for your use-case?

   import { ProxyAgent } from 'proxy-agent';
   const agent = new ProxyAgent(); // Automatically uses HTTP_PROXY/HTTPS_PROXY env vars

   // OR
   import { HttpProxyAgent } from 'http-proxy-agent';
   const agent = new HttpProxyAgent('http://168.63.76.32:3128');

   admin.initializeApp({
        ...
       httpAgent: agent,
   });

lahirumaramba avatar Nov 04 '25 16:11 lahirumaramba