-
Notifications
You must be signed in to change notification settings - Fork 223
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
Auth failed with com.apple.AuthenticationServices.AuthorizationError error 1000 #9
Comments
Works fine on simulators, I tested it a bunch just last night. 1000 is UNKNOWN error: https://github.com/invertase/react-native-apple-authentication/blob/master/docs/enums/_lib_index_d_.rnappleauth.appleautherror.md Not sure why, but maybe if you build in Xcode and watch the log it will include information? Including the code in use vs the babel-ized stack would likely help reproduce |
Thank you for the suggestion. I got this on xcode debug console.
And I'm using this code from example
Found this on Apple Developer forums, but looks like of no use. |
Can you re-try this without the requested operation? I am using it successfully, but without the requested operation, and I think the example is the same, and I recall someone else having a related problem? invertase/react-native-firebase#2979 (comment) Although it didn't seem to help there, so I assign low-probability of fix with that. For me I am integrating with react-native-firebase and I do not do getCredentialState, I just feed it directly to firebase and they work with the credential. Is it necessary to call that 🤔 The example does it https://github.com/invertase/react-native-apple-authentication/blob/master/example/app.js#L38 - can you reproduce with the example? |
Tried without requestedOperation, didn't work. What do you feed to firebase? I believe, a token is required from Apple Sign-in call to authenticate. |
No idea if this will be applicable, but here's the ridiculously-too-big method I use, works for me? async appleSignIn(link?: boolean): Promise<boolean> {
try {
const appleCredential = await AppleAuth.performRequest({
requestedOperation: AppleAuthRequestOperation.LOGIN,
requestedScopes: [AppleAuthRequestScope.EMAIL, AppleAuthRequestScope.FULL_NAME],
});
console.log(
'UserStore::appleSignIn - user result is:',
JSON.stringify(appleCredential, null, 2)
);
// FIXME we should really store the uid we get back, looks like:
// "uid": "000420.fa782337956f441eb0e23e43d8c337b5.0503" and is all we get in future
this.removeUserChangeListener();
if (appleCredential.email) {
const providers = await this.getProvidersForEmail(appleCredential.email);
console.log(
'UserStore::appleSignIn - got providers for email: ',
JSON.stringify(providers, null, 2)
);
// if google.com is not in the providers, it is first login via google.
let appleProvider = false;
let passwordProvider = false;
for (let i = 0; i < providers.length; i++) {
if (providers[i] === 'apple.com') {
appleProvider = true;
} else if (providers[i] === 'password') {
passwordProvider = true;
}
}
// If there are providers, but not apple, google actually just automatically does it right.
if (providers.length !== 0 && !appleProvider) {
if (passwordProvider) {
console.log(
'UserStore::appleSignIn - other providers but google auto-connects if it is password provider'
);
} else {
this.handleCredentialInUse();
return Promise.resolve(false);
}
}
// If this is the first time we are seeing apple, handle apple privacy
// Apple has specific requirements before linking non-anonymous
// FIXME this may be a problem though as email might not come through again?
// do we need to rely on uid here?
if (!appleProvider) {
console.log('UserStore::appleSignIn - verifying user is okay with apple + non-anonymous');
const choice = await AlertAsync(
I18NService.translate('LoginApplePrivacyTitle'),
I18NService.translate('LoginApplePrivacyText'),
[
{
text: I18NService.translate('Cancel'),
onPress: () => 'Cancel',
},
{
text: 'OK',
onPress: () => 'OK',
},
],
{
cancelable: false,
onDismiss: () => 'Cancel',
}
);
if (choice === 'Cancel') {
console.log(
'UserStore::appleSignIn - user does not want to link apple id + non-anonymous'
);
return Promise.resolve(false);
}
console.log(
'UserStore::appleSignIn - user is just fine linking apple id + non-anonymous'
);
}
// If there are no other providers we should ask if they already have an account
if (
providers.length === 0 &&
(!firebase.auth().currentUser?.providerData ||
firebase.auth().currentUser?.providerData.length === 0)
) {
console.log('UserStore::appleSignIn - no other providers. See if they are sure');
const choice = await AlertAsync(
I18NService.translate('LoginFirstLoginTitle'),
I18NService.translate('LoginFirstLoginText'),
[
{
text: I18NService.translate('LoginFirstLoginOtherAccountsButton'),
onPress: () => 'Other Accounts',
},
{
text: I18NService.translate('LoginFirstLoginPleaseContinueButton'),
onPress: () => 'Please Continue',
},
],
{
cancelable: false,
onDismiss: () => 'Please Continue',
}
);
if (choice === 'Other Accounts') {
console.log('UserStore::appleSignIn - user wants to handle other accounts');
return Promise.resolve(false);
}
console.log(
'UserStore::appleSignIn - user is just fine continuing and creating new account'
);
this.setIsNewUser(true);
}
} else {
console.log('UserStore::appleSignIn - no email present, not first apple sign in?');
}
// create a new firebase credential with the token
const credential = firebase.auth.AppleAuthProvider.credential(
appleCredential.identityToken,
appleCredential.nonce
);
console.log('UserStore::appleSignIn - credential is', JSON.stringify(credential, null, 2));
let firebaseUserCredential;
if (!link) {
// login with credential
firebaseUserCredential = await firebase.auth().signInWithCredential(credential);
Analytics.setAnalyticsUser(firebaseUserCredential.user.uid); // TODO, set our own ID?
Analytics.setAnalyticsUserProperties({ email: firebaseUserCredential.user.email });
Analytics.analyticsEvent('successAppleSignIn');
} else {
if (!firebase.auth().currentUser) {
return Promise.resolve(false);
}
firebaseUserCredential = await firebase.auth().currentUser?.linkWithCredential(credential);
Analytics.setAnalyticsUser(firebase.auth().currentUser!.uid); // TODO, set our own ID?
Analytics.setAnalyticsUserProperties({ email: firebase.auth().currentUser!.email });
Analytics.analyticsEvent('successAppleLink');
}
console.log(
'UserStore::appleSignIn - firebaseCredential was',
JSON.stringify(firebaseUserCredential)
);
this.userChangedHandler(
firebaseUserCredential!.user,
firebaseUserCredential!.additionalUserInfo
);
return Promise.resolve(true);
} catch (error) {
if (error.code === 'ERR_CANCELLED') {
// user cancelled the login flow
console.log('UserStore::appleSignIn - user cancelled');
} else if (error.code === AppleAuthError.CANCELED) {
// user cancelled the login flow
console.log('UserStore::appleSignIn - authentication request failed');
} else if (
error.code === 'auth/email-already-in-use' ||
error.code === 'auth/credential-already-in-use'
) {
console.log('UserStore::appleSignIn - email already in use, instruct on unlink/delete');
this.handleAccountInUse();
} else if (error.code === 'auth/account-exists-with-different-credential') {
this.handleCredentialInUse();
} else {
// some other error happened
console.log(
'UserStore::appleSignIn - unknown error?' + error,
JSON.stringify(error, null, 2)
);
RX.Alert.show(
I18NService.translate('ConnectedAccountsConnectionError'),
I18NService.translate(error.code)
);
}
} finally {
this.addUserChangedListener();
}
return Promise.resolve(false);
} |
on my simulator i got this AuthorizationError error 1000 but on device it's worked fine |
I had the same error, turns out I did not follow the firebase documentation and did not configure Sign In with Apple. After following the instructions it's working for me on both simulator and device. |
@colloquet I can't believe you missed one of the 2,431 things to configure in apple + firebase developer console for it to work 😅 (joking of course) |
I got this on the Simulator just now when I attempted apple sign-in for the first time and did not have my apple id set up. It set up the ID correctly but when I went back to the app it did not actually attempt sign-in, it just threw the 1000 error, then I tapped the sign-in button again and it worked. So maybe worth re-trying once when you see this error? unless it maps to other cases - test first of course |
I get the same error: |
Same error here, I'm reproduce the example without Firebase here but It didn't work. |
If the error appears after you perform the login then try to use a real device. It might be the case that it doesn't work on a simulator. |
You're right. It works on a real device |
Thank you for confirming this. It seems I will have to get a real device from somewhere. |
Just commenting to say it actually works for me in a simulator? But only the second time - the first time the simulator takes me through the whole "set up your iCloud account on this device" flow, then goes back to the app and I get error 1000. Then (with a valid iCloud account setup), apple sign in works just fine 🤷♂ |
Got the same error |
I get the error 1000 no matter how many times I try (after the "set up your iCloud account on this device"). Also, I checked the auth on a real device and it works. |
I fix it by configuration in xcode.
@colloquet suggestion is on point for me. Thank you :) |
Yes, In the case of @pacozaa and mine, I was missing adding the SingIn capabilities. Since you have to update XCode to be able to integrate with Apple SignIn. Is not obvious you need to click the + icon on the top to add such capability, In previous versions the capabilities are at glance you just need to check/uncheck. |
@alexxsanchezm Can you test your app on simulator? |
My problem is I only add I fixed it by add |
Yes, it works on the simulator as well.
|
I added |
I have the same error (I get the error 1000 no matter how many times I try (after the "set up your iCloud account on this device"). Also, I checked the auth on a real device and it works.) but I have the Sign In Capability both in Debug and Release versions. I am not using Firebase. |
I am testing on real device since beginning Xcode Version 11.2.1 (11B500) appleAuth.isSupported returns true though. I cleaned build folder, deleted drived data folder, reinstalled app into the device. no luck |
@amitbravo I noticed your screenshot only show you have added Sign In with Apple capability for your release build, can you check if it is also enabled under “All” or “Debug”? |
@colloquet thank you. it was unchecked at debug, its added and now working fine. |
Thank you, I had the same issue. |
Anybody has an issue on IOS Simulator like this. I have pop up open asking me to choose should I share my email or hide and then button Continue with a password. On next screen I enter password from my apple ID and nothing happens. Is something wrong on my side or it is simulator issue? |
This works fine. Help me a lot, ty! |
@SnowLew can you please propose a docs PR (you can do it just using the web UI on github) to save everyone else the trouble 🙏 🙏
|
THANK YOU! Removing and re-adding the Simulator on my Apple Developer account was the solution for me as well. |
I will write doc for this error and request a PR. thank you! Edit: @mikehardy I've send a PR adding some solutions for this issue. (readme) |
This worked for after trying so many solutions and enabling everything as per docs. Thanks |
Just a note for iOS 14+ and xcode 12+ as of now this seems to be a big issue. I'm currently having this problem so I'm downgrading to iOS 13.5 sim for testing. |
Working on my iPad with ios 14 and xcode 12 but not on mobile devices when i run with diawi and also from testflight. |
@ryansaam does downgrading ios to 13.5 works ? |
works on every ios14 iPhone real device I've tested it on. 11, SE, 7 |
@avbeladiya I also don't know what diawi is but I can confirm testing in a simulator running iOS 13.5 works for me. The problem also seems to be that if you upload a build to App Store Connect (using sign in with apple) they're rejecting it. So I'm also uploading iOS 13.5 builds. However an unrelated problem is messing that up too https://developer.apple.com/forums/thread/118719 |
ICOULD needs to logged in aswell. . Else you might always see error 1000 |
This happen also if you use not right signature from you apple (password) |
you guys might need to do this also https://dev.to/aryaminus/how-to-sign-in-with-apple-on-react-and-react-native-using-node-5g0b |
Anyone suffer from this problem like me can use iOS version 13.5 and iPhone 11 to overcome this problem, starting React native debugging with this command. Offcourse other versions may work but I tested and confirm the below command. |
I am assuming you are also using invertase library for adding sign up - sign in capability with React Native for iOS development. I would follow this document to accomplish this task https://rnfirebase.io/#3-ios-setup to install and https://rnfirebase.io/auth/social-auth#apple to use it. I hope it helps. |
Yes, I am using the library Sorry but the link you provided doesn't mention anything about the problem i am mentioning. Also, I am not using Firebase. |
I re-visited the link yes. Sorry for the delay. But Invertase is a library for adapting firebase easily with React Native |
I am still facing this issue I am using iOS 14.4 simulator |
Hey @MuhammadAbdullah54321 👋 - nothing you do on an ios14 simulator is valid unfortunately. ios13 is the only simulator I've seen work with apple sign in. Real devices work. The issue here pinned to the repo issue list has it #141 |
@Jalson1982 Were you able to fix this issue? |
@khagesh there is no fix. You must use ios13 simulator if you test this on the simulator |
@mikehardy ok. Sorry for commenting on closed thread. I thought the issue for continue with password keep loading is separate from what was being discussed above. I will use ios13 simulator |
I'm using the emulator and I'm having the same problem as @khagesh. As soon as I enter the Apple ID and password, I click Confirm, the app simply does not advance and a loading appears as if it was doing some process. The IOS version options I have on my Mac is 12.4 or 15.4. I tried to use 13.0, but I didn't find this version to use in the simulator to test on the iPhone |
You have to manually download it. It's inside Xcode preferences (then maybe make a new simulator definition using it stackoverflow can probably help you) You can also try the Xcode 14 beta, the iOS 16 emulators in there work (finally!) |
Thank you very much, @mikehardy ! It finally worked, after more than a week of trying to find a solution! My client was already starting to freak out hahaha... Now I just hope it works on a real device haha 😄 |
As there is one day left before notoriously "we'll reject your app for almost anything, and kind of randomly" apple app reviewers start applying this criteria - do pay attention to it as well - #282 - I haven't even handled this one myself, it looks generally like a big mess 😩 |
@colloquet Thank you for much, my problem was that the capability was not added for debug. THANK YOU! |
I'm testing this on a simulator with iOS 13.2.2 (Sign-in with Apple available)
I get the Apple Sign-in button and the auth popup shows up perfectly.
Upon entering password, I get the following error
Does it even work on simulators? What am I missing here?
Thank you.
The text was updated successfully, but these errors were encountered: