Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(auth, oauth): add native oauth support / no external packages needed #7019

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Aetherall
Copy link

@Aetherall Aetherall commented Apr 3, 2023

Description

Right now, documentation recommendation for oauth flows is to use the react-native-app-auth package.
What this package do is pretty close to the default behaviour of the firebase native sdk.

With the support of my company and of my teammates from kraaft.co, I had some time allocated to check whether I can bridge the native sdk with react native within react-native-firebase :)

The goals of such integration would be:

  • reduce the number of dependencies of the project
    • no need for react-native-app-auth if firebase does the same
  • avoid manual fetching of the configuration needed for each provider into react-native-app-auth
    • they are dynamic in our use case

Related issues

#349
#3926

Release Summary

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS -> If anyone knows his swift I'm down for some help :)
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e -> Would like to have some insights with detox and testing the popup
    • 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

we are deploying this on our staging, and will QA this soon

Think react-native-firebase is great? Please consider supporting the project with any of the below:

🔥

@vercel
Copy link

vercel bot commented Apr 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-firebase ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 29, 2023 9:34pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
react-native-firebase-next ⬜️ Ignored (Inspect) Jun 29, 2023 9:34pm

@CLAassistant
Copy link

CLAassistant commented Apr 3, 2023

CLA assistant check
All committers have signed the CLA.

@Aetherall
Copy link
Author

Aetherall commented Apr 7, 2023

working for android, ios coming soon

@Aetherall Aetherall changed the title WIP feat(oauth): added signIn and link for oauth feat(oauth): added signIn and link for oauth Apr 11, 2023
@Aetherall
Copy link
Author

@cedricboidin has added ios

@Aetherall Aetherall marked this pull request as ready for review April 11, 2023 13:32
@Aetherall Aetherall changed the title feat(oauth): added signIn and link for oauth feat(oauth): OAuth Support Natively RFR ( without external packages ) Apr 18, 2023
@Aetherall
Copy link
Author

Rebased on main.

I would appreciate some feedback on this PR :)
Nice day everyone

@github-actions
Copy link

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

@github-actions github-actions bot added the Stale label May 31, 2023
@mikehardy
Copy link
Collaborator

Sincere apologies for the delay! I'm processing the PR queue now and should have time to review this, I sincerely appreciate the effort and the patience

Copy link
Collaborator

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

This looks great! Happy to hear it's working for you in production that gives me a lot of confidence as I look to merge this.

I left a couple specific comments that are hopefully easy to handle

I rebased to current main and ran the linters so those hoops have already been jumped through

The only thing I can think of besides the specific comments is to add something in docs/auth - might make sense to great make a page there (slicing in to the prev/next links on two of the related pages to get the circular nav links going) ?

Functionally CI should go green now though 🤞 with fully up to date SDKs etc etc

Comment on lines +1776 to +1777
signInWithPopup(provider: AuthProvider): Promise<UserCredential>;
signInWithRedirect(provider: AuthProvider): Promise<UserCredential>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you document this here, even if briefly? The rnfirebase.io site is built from the typedoc so anything you put here will be seen + used

@@ -1950,6 +2074,7 @@ private WritableMap getJSError(Exception exception) {
String message = exception.getMessage();
String invalidEmail = "The email address is badly formatted.";

System.out.print(exception);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Dumping an error to System.out is discouraged, if it is already being propagated up, then I think this could be removed?

@mikehardy mikehardy added Workflow: Waiting for User Response Blocked waiting for user response. and removed Workflow: Needs Review Pending feedback or review from a maintainer. labels Jun 29, 2023
@mikehardy
Copy link
Collaborator

Looks like another of the test cases needs a modification similar to those already made:

  1) auth().currentUser
       linkWithPopup()
         should throw an unsupported error:
     AssertionError: expected Function { name: '' } to throw exception with a message matching 'firebase.auth.User.linkWithPopup() is unsupported by the native Firebase SDKs.', but got 'Cannot read properties of undefined (reading 'providerId')'
      at Assertion.fail (node_modules/should/cjs/should.js:275:17)
      at Assertion.value (node_modules/should/cjs/should.js:356:19)
      at Context.<anonymous> (/Users/runner/work/react-native-firebase/react-native-firebase/packages/auth/e2e/user.e2e.js:880:22)

@github-actions
Copy link

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Jul 27, 2023
@github-actions github-actions bot closed this Aug 11, 2023
@mikehardy
Copy link
Collaborator

Summer vacation time was busy enough the stale bot got this one, but it's a good looking chunk of work, hoping to get it shepherded through for merge

@mikehardy mikehardy reopened this Aug 18, 2023
@github-actions github-actions bot removed the Stale label Aug 18, 2023
@github-actions
Copy link

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Sep 15, 2023
@github-actions github-actions bot closed this Sep 30, 2023
@mikehardy
Copy link
Collaborator

scanning stale closed queue for unrelated reasons this still looks harvest-able

@mikehardy mikehardy reopened this Mar 25, 2024
@mikehardy mikehardy added Workflow: Needs Review Pending feedback or review from a maintainer. and removed Stale labels Mar 25, 2024
Copy link

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Apr 22, 2024
@mikehardy mikehardy added Keep Open avoids the stale bot and removed Stale labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: customer-response Keep Open avoids the stale bot plugin: authentication Firebase Authentication Workflow: Needs Review Pending feedback or review from a maintainer. Workflow: Waiting for User Response Blocked waiting for user response.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants