-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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,android): Apple Oauth provider support for Android #4188
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/invertase/react-native-firebase/7erzh6h3v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool thanks for this @spezzino !
I just wrote a new workflow for github that auto-generates patch-package patches for PRs and it looks like it worked, you can immediately apply this by downloading the zip of patches from the workflow run here https://github.com/invertase/react-native-firebase/suites/1126535643/artifacts/16014476
Do you have a library that you are using successfully to do sign in with Apple via Android? I/we could add some documentation to help others - both here and in our companion repo https://github.com/invertase/react-native-apple-authentication/
@mikehardy thanks for the quick turnaround. I'll test the patch-package and report back. For now, I'm using this library which is a combined fork of other two libraries (one manages the native webview that triggers the authentication, and the other provides RN integration), with added support to exchange the Quick example below Install the dependency: Autolink the native library:
|
@mikehardy the patch works, thanks |
@spezzino thanks for double-checking the patch output of the new patch-package-generator workflow here, I appreciate that. This was a really small change but in the future it should help with PR verification here on any PR I'll do a release of this soon, also I'm going to connect this with the react-native-apple-authentication issue tracking a possible Android implementation, it would be nice if that one library handled both! |
When I try this I get "[Error: [auth/invalid-credential] The supplied auth credential is malformed, has expired or is not currently supported.]" any idea what could cause that? I am not using the expo crypto I am using the crypto built into nodejs could it be the nonce?
that is how I am generating my nonce in my noed.js backend, which should do the same thing as your example, but for some reason I get that error. I don't think its nonce related, but thats the only difference in our code, so maybe? |
Just a guess. When I have seen that before it was the nonce. Either reusing an old nonce (they are one use only right?) or formatting |
Hmm I wonder what it could be. My nonce is in hex format, is that correct? I am not reusing an old one for sure, I have it generating a new one everytime I double checked that. |
From your example, you are creating a nonce each time you hash it. You need
to keep the original uuid (non hashed version) for Firebase, and send the
hashed version to apple.
…On Sun, 6 Sep 2020 at 15:15, SocialAnxty ***@***.***> wrote:
Just a guess. When I have seen that before it was the nonce. Either
reusing an old nonce (they are one use only right?) or formatting
Hmm I wonder what it could be. My nonce is in hex format, is that correct?
I am not reusing an old one for sure, I have it generating a new one
everytime I double checked that.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4188 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPLRNZJCUS3YWUJ7BG43LTSEL5FLANCNFSM4QRQX5VQ>
.
--
--
|
@SocialAnxty I don't have a lot to offer, but you might look at the initial efforts of integration with ios from December It was quite the saga, but has some "hand-crafted nonce" examples in it https://gist.github.com/mikehardy/83c9535d71cec4a8764bfda5a492c25f |
@spezzino I am doing that.
Basically I am calling this firebase function (node.js backend basically) which is sending me back the original randomString and the nonce. Then I am passing the original random string and nonce exactly like the example code. "you are creating a nonce each time you hash it" its possible I am doing this and do not know, but I am confused how? Is that happening here?
I have tried just about everything else that could be wrong so you guys are likely onto something with the nonce I just can't figure out whats wrong with the nonce |
You are using randomString as the secret rather than the data. You can even try to hash without a key.
Replace
const nonce = await crypto
.createHmac('sha256', randomString)
.update(uuid())
.digest('hex');
With
const nonce = await crypto
.createHmac('sha256', uuid())
.update(randomString)
.digest('hex');
|
Weird even with that, same error. Maybe its not the nonce? Idk what else it could be, I have triple checked everything else =\ |
Description
Add apple.com Oauth Provider support for Android.
Motivation
There are several libraries around that support Apple Sign In for Android. The provider for Apple was not enabled, making it imposible to sign in with Firebase and Apple id_token as it requires a different credential builder. See https://firebase.google.com/docs/auth/android/apple#java_9
Release Summary
AppleAuthProvider support for Android.
Checklist
Android
iOS
e2e
tests added or updated inpackages/\*\*/e2e
jest
tests added or updated inpackages/\*\*/__tests__
Test Plan
Tested in conjunction with other Apple SIgn In library. I was able to sign in with Firebase using Apple id_token.
Think
react-native-firebase
is great? Please consider supporting the project with any of the below:React Native Firebase
andInvertase
on Twitter🔥