capacitor-community / apple-sign-in

Sign in with Apple Support
MIT License
135 stars 58 forks source link

{"code":"UNIMPLEMENTED"} #89

Open hallbird opened 1 year ago

hallbird commented 1 year ago

Hello,

I have applied your package, however I am getting this error ⚡️ [error] - {"code":"UNIMPLEMENTED"}

my code is

` let options:SignInWithAppleOptions = { clientId: 'com.oplusstodio.cortado', redirectURI: 'https://xxxxxx.firebaseapp.com/__/auth/handler', scopes: 'email', state: '12345', nonce:"nonce" };

SignInWithApple.authorize(options)
      .then(async (res:SignInWithAppleResponse)=>{
        console.log(res)

        if (res.response && res.response.identityToken) {
        console.log(res)
        console.log(res.response)
    //    this.appAlertService.showAlert(JSON.stringify(res.response))
        }
      })
         .catch((response) => {
    console.log(response)
    //this.presentAlert();
  });

`

I am really confuse, what could be the error... since it dose not tell much

bppearsoft commented 1 year ago

I do not see that exact same error, but I am seeing "The operation couldn't be completed. (com.apple.AuthenticationServices.AuthorizationError 1000)."

On my iOS device, I am unable to enable to even see the initial Apple interface popup. I have a new Ionic project using Capacitor v8.19.3. I've configured all the profiles, identifiers, etc. on the Apple side (I have been using cordova Sign in with Apple with the same clientId for a few years already).

I've installed the plugin and my code is basically the same as @hallbird and the sample code on the readme page, with the exception that I have redirectURI: '' as I do not care about the web, just iOS (I've tried entering a value here too, but no luck).

Although it states this is for v4 Capacitor, is it correct to assume this will work with v8? Does anyone know if I've overlooked something needed to get this to work?

hallbird commented 1 year ago

I think ... there is an issue ... since Apple login was working fine until an update to the new iOS 16.2 ... it got failed

bppearsoft commented 1 year ago

@hallbird I finally got it working. Here's the steps I took, hopefully it will help and save some time for other devs needing this plugin.

I started with the brand new ionic capacitor template tabs project (Capactor v8.19.3). I added iOS and Android then built using 'npm run build' then ran the app locally with 'ionic serve' on localhost:8100. I installed the apple-sign-in plugin as seen in the readme.

Over on Apple (developer.apple.com), I created the necessary certificates, identifiers, etc. making sure the identifier had 'Sign in with Apple' selected (enabled as primary AppID).

I opened my app in xcode (pointing to the /ios/app/app location) and in the UI with the first App folder selected on the left, clicked the Signing & Capabilities tab and completed the Signing form (team & bundle id). Then using the +Capability button added Sign in with Apple. This created an App.entitlements file. Without this the plugin will not work. This is the step I did not know about and the reason for my initial post in this thread.

Back in my sample tabs project, I added a button to call the Authorize method of the plugin as seen in the readme page.

I had already updated my phone and ipad to iOS 16.3 so not sure if this would have failed in 16.2.

hallbird commented 1 year ago

Hi,

Still struggle ... I have App.entitlements

image : https://ibb.co/kcykx6B

I have delete the configuration in Apple developer and add it again and still the same...

the challenge is no clear error ... which makes this hard to catch ...

I hope some face this issue before and support and us

bppearsoft commented 1 year ago

@hallbird maybe try the steps I outlined above by creating a brand new capacitor application. That was the only way I could be certain of each step and if followed correctly the plugin has to work, at least the user interface should appear. I am not sure about the firebase backend as I didn't use that, instead connecting to our own node server hosted on heroku.

Vatanay commented 11 months ago

I am experiencing the same issue as well. I am getting the {"code":"UNIMPLEMENTED"} error.

During the configuration of the App ID, I checked the "Enable as a primary App ID" option, and it includes the "Sign In with Apple" capability. Similarly, I activated the relevant capabilities in Xcode.

I am wondering if the RedirectURI might be entered incorrectly. During the bundle creation process for the app, it didn't request a RedirectURI for Apple Login authorization. Therefore, in my JS code, I tried almost everything possible for this field, but none of them resulted in success.

I have tested the integration on the browser, emulator, and mobile device. I also tried using TestFlight, but it still doesn't work.

iOS: 16.5.1 Xcode: 14.3.1

AAmeriyan commented 9 months ago

Same here! getting {"code":"UNIMPLEMENTED"} Capacitor 5 on Native ios device version 17.0.2

luisUrielLeano commented 2 months ago

Hi , I was struggling for days with the same problem, and this was my solution. While reviewing the project generated for IOS, I discovered that the source files for the library had fewer lines of code than in anther project where the library was working correctly( I created a new one from scratch just to test the library). Upon discovering this, I deleted the packages(node modules), reinstalled them, and then synchronized with Capacitor using the respective command. Once I did this, the source files had the same number of lines, and the flow ran correctly (tested in simulator with one of latest IOS version and physical device Iphone 15). I hope this solution will be helpful to the community.