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

Add rowNonce on signIn w/ Apple response #867

Open
TheNotorius0 opened this issue Feb 11, 2024 · 0 comments · May be fixed by #883
Open

Add rowNonce on signIn w/ Apple response #867

TheNotorius0 opened this issue Feb 11, 2024 · 0 comments · May be fixed by #883

Comments

@TheNotorius0
Copy link

TheNotorius0 commented Feb 11, 2024

As a follow up of this issue: #857

I've tried using signInWithCredential of Firebase javascript SDK after signing-in with Apple with the following code:

            FirebasePlugin.authenticateUserWithApple(function (credential) {

                const appleProvider = new firebase.auth.OAuthProvider('apple.com');
                const appleWebCredentials = appleProvider.credential({idToken: credential.idToken});

                firebase.auth().signInWithCredential(appleWebCredentials).then((result) => {

                    showToastShort('Logged-in with Apple');
                });
            });

Unfortunately, it gave me this error:

FirebaseError: Firebase: Nonce is missing in the request. (auth/missing-or-invalid-nonce).

I already manually fixed the issue by modifying the plugin (passing the rawNonce) and it now works. This is what I changed:

[result setValue:rawNonce forKey:@"rawNonce"]; on line 527, under [result setValue:idToken forKey:@"idToken"]; of the AppDelegate+FirebasePlugin file.

The Cordova updated and working code now is:

const appleWebCredentials = appleProvider.credential({idToken: credential.idToken, rawNonce: credential.rawNonce});

Could this change be implemented in an upcoming release? Thank you in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant