Expo Apple Signin package expo-apple-authentication not working on published app on Testflight

Viewed 278

I setup the package expo-apple-authentication as described on the documentation: https://docs.expo.dev/versions/v41.0.0/sdk/apple-authentication/ and when on development mode on Expo Go it works perfect but when I deliver the app using transporter that wants to test it on TestFlight it doesn't work properly. I don't know how to debug the app on TestFlight to check the error on the console to know what's going on. Can somebody help me out with this please?

This is the function that I'm using to sign-in the user:

const appleSignIn = async () => {
    try {
      const response = await AppleAuthentication.signInAsync({
        requestedScopes: [
          AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
          AppleAuthentication.AppleAuthenticationScope.EMAIL,
        ],
      });

      if (response.email != null) {
        const appleUser = {
          fullName: `${response.fullName.givenName} ${response.fullName.familyName}`,
          email: response.email,
          password: response.email,
        };
        await Storage.setItem('appleUser', JSON.stringify(appleUser));
        const isUserSignIn = await signInUser(
          appleUser.email,
          appleUser.password,
          true
        );
        if (!isUserSignIn) {
          showMessage({
            message:
              'Error: No existe un usuario con ese email debe registrarse',
            type: 'danger',
          });
        }
      } else if (response.authorizationCode != null) {
        const appleUser = (await Storage.getItem('appleUser'))
          ? JSON.parse(await Storage.getItem('appleUser'))
          : null;
        if (appleUser != null) {
          const isUserSignIn = await signInUser(
            appleUser.email,
            appleUser.password,
            true
          );
          if (!isUserSignIn) {
            showMessage({
              message:
                'Error: No existe un usuario con ese email debe registrarse',
              type: 'danger',
            });
          }
        }
      }
    } catch (e) {
      if (e.code === 'ERR_CANCELED') {
        // handle that the user canceled the sign-in flow
        showMessage({
          message: 'Entrada cancelada',
          type: 'danger',
        });
      } else {
        // handle other errors
        showMessage({
          message: 'No se tuvo acceso a su cuenta de Apple',
          type: 'danger',
        });
      }
    }
  };

On test flight always goes to the last else statement for unexpected errors.

0 Answers
Related