feat: add OAuth2 refresh token credential support#207
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for OAuth2 refresh token credentials in the Firebase Admin SDK. It adds new factory methods, Credential.fromRefreshToken and Credential.fromRefreshTokenParams, along with the RefreshTokenCredential implementation which handles auto-refreshing authenticated HTTP clients. The changes also include comprehensive unit and integration tests, and updated documentation for running these tests. One review comment suggests improving the fromRefreshTokenParams API by making the type parameter optional with a default value, as it is currently required but not utilized in the internal constructor.
2bed2b7 to
993c86e
Compare
Coverage Report✅ Coverage 74.63% meets 40% threshold Total Coverage: 74.63% Package Breakdown
Minimum threshold: 40% |
Adds explicit support for OAuth2 refresh token credentials from a custom file path or raw parameters, for cases where the default ADC file location isn't sufficient.
Credential.fromRefreshToken(File)factory — reads and parses an OAuth2 refresh token JSON file (e.g.~/my-project/credentials.json)Credential.fromRefreshTokenParams({clientId, clientSecret, refreshToken, type})factory for constructing the credential from individual parametersfirebase_app_prod_test.dartexercising the new credential against a real Firebase project