Search code examples
xamarinxamarin.formsxamarin.iosvisual-studio-macapple-sign-in

com.apple.AuthenticationServices.Authorization Error Code 1000


I receive the following error in DidCompleteWitherror:

com.apple.AuthenticationServices.Authorization Error Code 1000

I'm using the following code to sign in to Apple

var appleIdProvider = new ASAuthorizationAppleIdProvider();
var request = appleIdProvider.CreateRequest();
request.RequestedScopes = new ASAuthorizationScope[] { ASAuthorizationScope.Email, ASAuthorizationScope.FullName };
var authController = new ASAuthorizationController(new[] { request });
authController.Delegate = this;
authController.PresentationContextProvider = this;
authController.PerformRequests();
...
[Export("authorizationController:didCompleteWithAuthorization:")]
public void DidComplete(ASAuthorizationController controller, ASAuthorization authorization)
{
...
}

[Export("authorizationController:didCompleteWithError:")]
public void DidComplete(ASAuthorizationController controller, NSError error)
{
...
}
  • I checked Apple Sign-in in the Entitlements.plist
  • I created app id in the management console, verified my domain. Even web auth works already.
  • I tried to switch provisioning profile to one with apple sign in.

What could be the reason of this error?


Solution

  • Turns out to be problems with missing settings in csproj.

    I opened csproj and discovered some build configuration were missing CodesignEntitlements and some of them were empty:

    <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
    

    After adding it to/updating it in all build configurations it finally works.

    PS: Before that I tried to create empty xamarin project (with the same bundle name) and it reproduced the problem on simulator. Then I did swift project (with the same bundle name) and it worked fine. So it was clear that it was xamarin specific bug.