Using Native Sign in with Expo AppleAuthentication, no response with correct password on Simulator

140 views Asked by At

Supabase is my BE and it's suggested by Supabase to use the Native Sign in with Apple in Expo.

Then followed the Expo Docs for Native Login which has the ✅ that Simulator is supported.

I installed & built on EAS after watching the Supabase implementation video. Seems pretty straight forward. I added & run in the Simulator which is supposedly supported:

  • Apple Auth Provider in Supabase with the Authorized Client IDs for host.exp.Exponent,com.myapp.production,com.myapp.dev for matching EAS build references.
  • Inside the AppStore Connect Certificates, Identifiers & Profiles section > enabled Sign in with Apple for all above bundle Client IDs
  • Updated app.config as recommended

Then in my code pasted the Expo snippet:

const signInWithApple = async () => {
    try {
      console.log('AppleAuthentication.signInAsync'); // this gets logged to terminal

      const credential = await AppleAuthentication.signInAsync({
        requestedScopes: [
          AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
          AppleAuthentication.AppleAuthenticationScope.EMAIL,
        ],
      });
      console.log({ credential }); // This does not get logged to terminal

      // Sign in via Supabase Auth.
      if (credential.identityToken) {
        const {
          error,
          data: { user },
        } = await supabase.auth.signInWithIdToken({
          provider: 'apple',
          token: credential.identityToken,
        });

        if (!error && user) {
          console.log(user);
          // setSession(user);
        }
      } else {
        throw new Error('No identityToken.');
      }
    } catch (e: unknown) {
      const { code, message } = e as {
        message: string;
        code: 'ERR_REQUEST_CANCELED';
      };
      if (code === 'ERR_REQUEST_CANCELED') {
        console.error(message);
        // handle that the user canceled the sign-in flow
      } else {
        // handle other errors
      }
    }
  };

Why, when using the Simulator, the AppleAuthentication.signInAsync stalls out after I type in my correct credentials?
However, if I type in my incorrect credentials, the Native SignIn UI shows the error "shake" of the password input, so it seems like it's hitting the Apple BE correctly.

what could it be, since it works in the Device itself?

0

There are 0 answers