feat: add OAuth2 refresh token credential support#207
Draft
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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