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): Access to FIRAuthErrorUserInfoUpdatedCredentialKey with Apple Sign In #4359

Merged
merged 3 commits into from
Oct 7, 2020

Conversation

henrik-d
Copy link
Contributor

@henrik-d henrik-d commented Oct 6, 2020

Description

Upgrading an anonymous user requires to link the anonymous account with a credential. This operation can fail, if the credential is already associated with another account. A common case is, that you want to sign in to this account then. For most auth providers the first credential can be reused for the sign in operation. In case of Apple Auth, we receive an updated credential in the error.

This PR passes the updated credential (better said: an identifier for the credential) to React Native.

Related issues

Fixes #3952 on iOS.

Release Summary

Pass updated authCredential when linkWithCredential() failed with auth/credential-already-in-use for Apple Auth

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
  • 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


🔥

@CLAassistant
Copy link

CLAassistant commented Oct 6, 2020

CLA assistant check
All committers have signed the CLA.

@vercel
Copy link

vercel bot commented Oct 6, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/invertase/react-native-firebase/ef1go89hy
✅ Preview: https://react-native-fireb-git-52b97be68541ccdfa8ce648fd50b279b3-bec0f1.invertase.vercel.app

@codecov
Copy link

codecov bot commented Oct 6, 2020

Codecov Report

Merging #4359 into master will decrease coverage by 0.57%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #4359      +/-   ##
==========================================
- Coverage   67.12%   66.55%   -0.56%     
==========================================
  Files         114      114              
  Lines        3819     3820       +1     
  Branches      278      278              
==========================================
- Hits         2563     2542      -21     
- Misses       1147     1169      +22     
  Partials      109      109              

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.

I have some concerns about the semantics of getCredentialForProvider with this change but in general it looks either very close or maybe correct, thanks!

packages/auth/ios/RNFBAuth/RNFBAuthModule.m Show resolved Hide resolved
@mikehardy mikehardy added the Workflow: Waiting for User Response Blocked waiting for user response. label Oct 6, 2020
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.

I love the types change but the tests directory changes should be excluded :-)

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.

a thing of beauty!

@mikehardy mikehardy removed the Workflow: Waiting for User Response Blocked waiting for user response. label Oct 7, 2020
@mikehardy mikehardy merged commit 5851bd0 into invertase:master Oct 7, 2020
nealmanaktola added a commit to nealmanaktola/react-native-firebase that referenced this pull request Nov 2, 2020
This fixes an issue with Apple sign on Android. iOS was fixed with this commit. iOS was fixed with this PR invertase#4359. Note the solution is different. On iOS, it looks like we bubble the auth credentials back to js land and then retry login. Here, we attempt another login on auth collision errors
mikehardy pushed a commit that referenced this pull request Nov 10, 2020
…4487)

This fixes an issue with Apple sign on Android. iOS was fixed with this commit. iOS was fixed with this PR #4359. Note the solution is different. On iOS, it looks like we bubble the auth credentials back to js land and then retry login. Here, we attempt another login on auth collision errors
androidIsForVivek pushed a commit to androidIsForVivek/react-native-firebase that referenced this pull request Sep 15, 2021
…pple Sign In (invertase#4359)

* Access to FIRAuthErrorUserInfoUpdatedCredentialKey with Apple Sign In
* Updates type definition
androidIsForVivek pushed a commit to androidIsForVivek/react-native-firebase that referenced this pull request Sep 15, 2021
…nvertase#4487)

This fixes an issue with Apple sign on Android. iOS was fixed with this commit. iOS was fixed with this PR invertase#4359. Note the solution is different. On iOS, it looks like we bubble the auth credentials back to js land and then retry login. Here, we attempt another login on auth collision errors
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.

🔥 Access to FIRAuthErrorUserInfoUpdatedCredentialKey with Apple Sign In
3 participants