Skip to content

Issue-26 - Accept Explicit Project Id.#27

Merged
expl merged 7 commits intoexpl:mainfrom
Sydney-o9:feature/Issue-26-Accept-Explicit-Project-Id
Mar 25, 2026
Merged

Issue-26 - Accept Explicit Project Id.#27
expl merged 7 commits intoexpl:mainfrom
Sydney-o9:feature/Issue-26-Accept-Explicit-Project-Id

Conversation

@Sydney-o9
Copy link
Copy Markdown
Contributor

@Sydney-o9 Sydney-o9 commented Mar 20, 2026

Context

When Firebase and infrastructure run in separate GCP projects, GOOGLE_CLOUD_PROJECT is already taken by the infrastructure project.

This pull request adds a constructor as reported in Issue 26 that accepts the Firebase project ID directly, bypassing env var and credential header resolution adequately.

There are no breaking changes. 2 breaking changes have been reported and fixed.

Changes

  • lib/src/lib.rs — new App::live_with_project_id(project_id: &str) on App<AccessTokenCredentials>
  • README.md — usage example and motivation for the new constructor
  • examples/explicit_project_id/ — runnable example

- [x] Added a new method live_with_project_id to allow implementers to appropriately select a dedicated project id.
- [x] Updated README.md accordingly.
- [x] Added an example in the examples/ folder
@Sydney-o9
Copy link
Copy Markdown
Contributor Author

Sydney-o9 commented Mar 22, 2026

@expl All formatting / linting / tests are passing and the workflow will now pass if you run it.

Copy link
Copy Markdown
Owner

@expl expl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your PR and sorry for not replying promptly.

Some feedback:

  1. A full example just to demonstrate a new constructor is probably not required.
  2. Due to an oversight in my implementation, this change breaks the id_token_verifier() and cookie_token_verifier() implementation on the same impl block, just assigning project_id to self.project_id.clone() is sufficient and would not break with your change, do you mind including this in your PR?

- [x] Updated id_token_verifier() and cookie_token_verifier() to use self.project_id instead of asynchronously getting the project id from credentials. This addresses PR comment https://github.com/expl/rs-firebase-admin-sdk/pull/27\#pullrequestreview-3997213998
@Sydney-o9
Copy link
Copy Markdown
Contributor Author

Sydney-o9 commented Mar 24, 2026

Thank you for your PR and sorry for not replying promptly.

@expl 👍

  1. A full example just to demonstrate a new constructor is probably not required.

Addressed in 09ca552

  1. Due to an oversight in my implementation, this change breaks the id_token_verifier() and cookie_token_verifier() implementation on the same impl block, just assigning project_id to self.project_id.clone() is sufficient and would not break with your change, do you mind including this in your PR?

Great catch! Addressed in 607ae38

Ready for review

@kostas-petrikas
Copy link
Copy Markdown

Great catch! Addressed in 607ae38

Thank you,

The last request from me is to keep the function signatures the same without removing the async, to not introduce breaking changes to the API. I will simplify the signatures with a next big patch.

- [x] Reverted functions to async
@Sydney-o9
Copy link
Copy Markdown
Contributor Author

The last request from me is to keep the function signatures the same without removing the async, to not introduce breaking changes to the API. I will simplify the signatures with a next big patch.

Oops, should have anticipated that.. Updated in b1d8971

@expl expl merged commit 6295e1e into expl:main Mar 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants