invertase / react-native-apple-authentication

A React Native library providing support for Apple Authentication on iOS and Android.
Other
1.4k stars 223 forks source link

com.apple.AuthenticationServices.AuthorizationError error 1001. #301

Closed nikitph closed 11 months ago

nikitph commented 1 year ago

This has just started showing up for us. Does anyone know why it has started happening? the scenario is that of a user using our app for first time and signing up using apple.

  postAppleLogin: (params: SocialRequest) => any,
) => {
  try {
    setLoading(true);
    setLoadingMessage('Signing in with Apple');
    const appleAuthRequestResponse = await appleAuth.performRequest({
      requestedOperation: appleAuth.Operation.LOGIN,
      requestedScopes: [appleAuth.Scope.FULL_NAME, appleAuth.Scope.EMAIL],
    });
mikehardy commented 1 year ago

https://stackoverflow.com/help/how-to-ask https://stackoverflow.com/help/minimal-reproducible-example

nikitph commented 1 year ago

This is not a bug report (as of right now) This is more of a discussion request to take help from the community. Perhaps it would help to put in tags like a few other repos have of 'bug', 'questions' etc.

mikehardy commented 1 year ago

My links are still valid for discussion requests. I don't see a huge difference between discussion requests and bug reports. I do see a tremendous amount of time spent inefficiently when people discuss technical topics without precision though :shrug:

nikitph commented 1 year ago

The difference is in a bug report you can apply the bug report templates and enforce this hardened reproducibility condition. A discussion is simply people in the loop discussing about a topic they might have run across. speaking of topic do you have any relevant information about what error 1001 is in the context of the library? Thats the crux of this entire thing.

mikehardy commented 1 year ago

It's vague, all apple error codes are vague and either not documented at all or poorly if at all. That's apple :shrug: My link on how to ask is still valid. You provide no details on what test you are actually running in what environment and what versions, but you want to discuss. It wastes time, yours and mine.

It's probably just a non-working simulator version. It only works on ios13 or ios16, ios14+15 do not work with apple authentication

But you don't specify at all what you are doing so :shrug:

nikitph commented 1 year ago

This is a production bug. I m simply trying to login on a real device. And the funny thing is this entire flow was working yesterday, We have had error reports on Sentry where its failing with 1001 on this line and its reproducing on a real device. So a minimal reproducible example is essentially to simply generate a request like the following and it fails with an 1001. If you want a MRE repo to understand and center on the problem, i have already done that for you.

const appleAuthRequestResponse = await appleAuth.performRequest({
      requestedOperation: appleAuth.Operation.LOGIN,
      requestedScopes: [appleAuth.Scope.FULL_NAME, appleAuth.Scope.EMAIL],
    });
nikitph commented 1 year ago

If this much info is insufficient for you to make progress, don't sweat it for the time being. If this is a widespread problem, i m sure others will see this thread and update it accordingly. Then we can resolve it in a collaborative manner. Otherwise we will do some debugging on our end.

mikehardy commented 1 year ago

What version are you using? What version of the iOS operating system is it happening on? Are you able to reproduce with the example here in repo?

topheroes commented 1 year ago

Hello,

Same bug here. Tried version 2.1.2 and 2.2.2 iOS version 16.0.3 (20A392) The example shows the same bug too.

mikehardy commented 1 year ago

@topheroes do you see this on a real device, if so which one, and do you see anything interesting in Console.app while this occurs?

topheroes commented 1 year ago

@mikehardy It's real device, IPhone 8 The logs are like follows:

2022-10-25 10:04:00.629574+0300 testing[1157:66125] [javascript] Beginning Apple Authentication
2022-10-25 10:04:08.648304+0300 testing[1157:66314] [siwa] Authorization failed: Error Domain=AKAuthenticationError Code=-7003 "(null)" UserInfo={AKClientBundleID=com.test.test}
2022-10-25 10:04:08.648605+0300 testing[1157:65877] RNAppleAuth -> didCompleteWithError
2022-10-25 10:04:08.649219+0300 testing[1157:65877] The operation couldn’t be completed. (com.apple.AuthenticationServices.AuthorizationError error 1001.)
2022-10-25 10:04:08.661206+0300 testing[1157:66125] [javascript] User canceled Apple Sign in.
mikehardy commented 1 year ago

7003 is very sparsely documented as a code, here's about the only thing I found https://developer.apple.com/forums/thread/700734 - so...maybe something to do with the provisioning profile and the UUID of the device itself, enrolled in the account? Or the profile for the app? I'm guessing wildly here, I have nothing to really back that up.

Note that the higher level "1001" error hides all these sub-errors underneath, so this may not be relevant to the original poster as they may have a different sub code.

johndpope commented 1 year ago

just double check

*Ensure that you pass the clientID as the web service ID, not the native app bundle. Since the project utilizes the service ID for authenticating web and android.*
FadiAboMsalam commented 1 year ago

@nikitph am facing same issue on certain devices on ios 16.5 any update on/ if you fixed it somehow 🤔

nikitph commented 1 year ago

@FadiAboMsalam It just stopped happening for us without any changes 🤷🏽‍♂️ i m really sorry i dont have any specific advice for you. We have a sentry observer to inform us immediately this starts happening again

FondueBug commented 11 months ago

Facing the same exact issue after updating to IOS 16.5, tried to update to 16.7 and its still the same issue, apple team also got this issue and they rejected the app.

mikehardy commented 11 months ago

With apologies, given the on/off nature of the error, and that it is not happening for everyone - as maintainer - this does not look actionable. The library is working or it would break for everyone, correct? So, this is something particular to projects and apple back-end.

Feel free to continue the discussion but unactionable issues are closed so that the open issues list is only actionable items

RobertMrowiec commented 10 months ago

I've got the same error, but it shows only if user CANCELLED the login - so I'm just skipping it. Maybe that's your case too?

mzruiz commented 1 week ago

I found this Error obj in the codebase that shows 1001 as CANCELLED.

mikehardy commented 1 week ago

@mzruiz PRs happily accepted