Skip to content

feat(auth): expose OAuth credential tokens in user credential result#9025

Open
sagnik2001 wants to merge 2 commits into
invertase:mainfrom
sagnik2001:feat/auth-oauth-credential-result
Open

feat(auth): expose OAuth credential tokens in user credential result#9025
sagnik2001 wants to merge 2 commits into
invertase:mainfrom
sagnik2001:feat/auth-oauth-credential-result

Conversation

@sagnik2001
Copy link
Copy Markdown

Related issues

Fixes #8316

Release Summary

Include OAuth credential token data on Auth UserCredential results.

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
    • Other (macOS, web)
  • My change includes tests;
    • e2e tests added or updated in packages/**/e2e
    • jest tests added or updated in packages/**/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan

Ran:

yarn tests:jest packages/auth/__tests__/auth.test.ts
yarn tsc:compile
yarn tsc:compile:consumer
yarn lint:js
yarn lint:ios:check
yarn reference:api
yarn compare:types
git diff --check

Also checked Android formatting for the touched Java file:

JAVA_HOME=/opt/homebrew/opt/openjdk PATH=/opt/homebrew/opt/openjdk/bin:$PATH ./node_modules/.bin/google-java-format --set-exit-if-changed --dry-run packages/auth/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthModule.java

No e2e test was added because this change is covered at the bridge serialization/type level and a full OIDC runtime test requires provider configuration.



@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Firebase Auth module by ensuring that OAuth credential tokens, such as access tokens and ID tokens, are correctly passed from native platforms (Android and iOS) and the web implementation to the JavaScript layer. This change addresses a long-standing gap in the UserCredential result, enabling developers to access provider-specific tokens after successful authentication.

Highlights

  • OAuth Credential Support: Added support for including OAuth credential tokens (accessToken, idToken, secret) in the Auth UserCredential result across Android, iOS, and Web platforms.
  • TypeScript Definitions: Updated TypeScript type definitions to include the new OAuthCredential interface and updated the UserCredential interface to expose this information.
  • Testing: Added unit tests in packages/auth/tests/auth.test.ts to verify that native auth results correctly serialize and include OAuth credential data.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sagnik2001 sagnik2001 changed the title feat(auth): include OAuth credential tokens in auth result feat(auth): expose OAuth credential tokens in user credential result May 16, 2026
Copy link
Copy Markdown
Contributor

@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 implements OAuth credential support in the UserCredential object for Android, iOS, and Web, enabling access to provider tokens and secrets. It includes updated TypeScript definitions, native mapping logic, and new tests. Reviewer feedback suggests using SharedUtils.mapPutValue on Android for cleaner code and applying consistent null handling for the provider ID on iOS to ensure safety across the React Native bridge.

Comment thread packages/auth/ios/RNFBAuth/RNFBAuthModule.m Outdated
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.

🚀 [auth] Include access token and ID token in auth result

3 participants