capacitor-community / apple-sign-in

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

[RESOLVED] [VUE] Error in iOS: "code":"UNIMPLEMENTED" / And in web: SignInWithApple.Authorize() is not implemented on web #58

Closed sbellver closed 2 years ago

sbellver commented 2 years ago

Describe the bug I'm using Capacitor 3 & Quasar Framework (Vue)

To Reproduce

  1. Configure Xcode with Apple Sign In capabilities

  2. Install capacitor plugin (nom install...)

  3. Import to Vue page import { SignInWithApple, SignInWithAppleResponse, SignInWithAppleOptions, } from '../../../src-capacitor/node_modules/@capacitor-community/apple-sign-in';

  4. Configure options

    const options = {
        clientId: 'domain.name',
        redirectURI: 'https://api.url/login',
        scopes: 'email name',
        state: '12345',
        nonce: 'nonce',
      };
  5. Add function to login

SignInWithApple.Authorize(options)
        .then(async (AppleUser) => {
          if (AppleUser.AppleUserponse && AppleUser.AppleUserponse.identityToken) {
            this.user = AppleUser.AppleUserponse;
            this.$api.post('social_login', AppleUser.AppleUserponse).then(({ data }) => {
              this.$api.defaults.headers = { common: { Authorization: `Bearer ${data.token}` } };
              this.$q.localStorage.set('token', data.token);
              this.$q.localStorage.set('user', data.user);
              this.$store.commit('user', data.user);
              this.$router.push({ name: 'home' });
            }).catch(() => {
              this.$router.push({ name: 'signup', params: AppleUser });
            });
          } else {
            this.presentAlert();
            console.log('Algo ha fallado en el Signin');
          }
        })
        .catch((response) => {
          console.log(response);
          console.log('Algo a fallado en el response');
        });

Then, when I press the button and call the loginApple() I get in Xcode debug :

⚡️  [log] - Entramos en el signin
⚡️  [log] - {"code":"UNIMPLEMENTED"}
⚡️  [log] - Algo a fallado en el response
sbellver commented 2 years ago

With the same code, if I use it on web:

Error: "SignInWithApple.Authorize()" is not implemented on web

:'(

nicolardi commented 2 years ago

it's the same here!

sbellver commented 2 years ago

This function is near to work

loginApple() {
      const options = {
        clientId: 'es.yakk.api',
        redirectURI: 'https://api.yakk.es/api/login_apple',
        scopes: 'email name',
        state: '1231232132141512421',
        nonce: 'nonce',
      };
      return SignInWithApple.authorize(options)
        .then((res) => {
          console.log(res);
          console.log('Apretamos el boton');
          return 0;
        }).catch((e) => {
          console.log(e);
          console.log('Nos vamos fuera');
        });
    },

Now, I push apple signings button and works, ask me about share email and then login.

Next step is confirm password. In this stage it hangs. No logs, simply do nothing.

sbellver commented 2 years ago

With last code, I can set user & password, I close this issue and continue on https://github.com/capacitor-community/apple-sign-in/issues/60

katche70 commented 2 years ago

Same Problem here. Used Code from @sbellver , but error is still existing