Skip to content

feat: add OAuth2 refresh token credential support#207

Draft
demolaf wants to merge 3 commits intomainfrom
refresh-token-auth
Draft

feat: add OAuth2 refresh token credential support#207
demolaf wants to merge 3 commits intomainfrom
refresh-token-auth

Conversation

@demolaf
Copy link
Copy Markdown
Member

@demolaf demolaf commented Mar 31, 2026

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.

  • Adds Credential.fromRefreshToken(File) factory — reads and parses an OAuth2 refresh token JSON file (e.g. ~/my-project/credentials.json)
  • Adds Credential.fromRefreshTokenParams({clientId, clientSecret, refreshToken, type}) factory for constructing the credential from individual parameters
  • Adds unit tests covering valid credentials, missing/empty fields, malformed JSON, and unreadable files
  • Adds integration test in firebase_app_prod_test.dart exercising the new credential against a real Firebase project

@demolaf demolaf marked this pull request as draft March 31, 2026 16:32
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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.

@demolaf demolaf force-pushed the refresh-token-auth branch from 2bed2b7 to 993c86e Compare April 1, 2026 09:16
@demolaf demolaf changed the title feat: implement OAuth2 refresh token credential support feat: add OAuth2 refresh token credential support Apr 1, 2026
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.

1 participant