React Native/Expo - Browser doesn't open the second time with JWT login (Apple Sign In)

Initialization:

const web3auth = new Web3Auth(WebBrowser, SecureStore, {
  clientId,
  redirectUrl,
  network: OPENLOGIN_NETWORK.SAPPHIRE_DEVNET,
  loginConfig: {
    google: {
      verifier: "u-social",
      verifierSubIdentifier: "u-google",
      typeOfLogin: "google",
      clientId: process.env.EXPO_PUBLIC_GOOGLE_CLIENT_ID,
    },
    jwt: {
      verifier: "u-social",
      verifierSubIdentifier: "u-apple",
      typeOfLogin: "jwt",
      clientId: process.env.EXPO_PUBLIC_WEB3AUTH_CLIENT_ID,
      jwtParameters: {
        verifierIdField: "email",
        domain: "https://appleid.apple.com",
      },
    },
  },

I have implemented aggregate verifiers with Apple login without a third-party login provider (Auth0/Firebase), just Sign In with Apple directly using the ID Token returned by Apple and the JWKS from: https://appleid.apple.com/auth/keys. Also, Google login with my own Google Client ID.

It works fine on the happy path If I don’t cancel the flow before finishing the login process either by pressing cancel on the alert with the request to open the browser or closing the browser before it finishes the flow, but If I cancel the first attempt (either with Apple or Google) and then try to login with Apple the second time, the sign in modal opens, the id token returns fine, but web3auth.login doesn’t open the browser. There’s no error at all it just doesn’t open/doesn’t show the alert to open the browser. It only happens with Apple (JWT), if I try with Google the second time, it works fine.

I tried almost everything, reinitializing the instance after getting the error for canceling the auth flow, creating the instance for every login, triggering a re-render after the login flow fails, etc.

Any idea what could be the issue? Let me know if I need to provide more info.

Hi Alejandro,

Thank you for reaching out, and I appreciate the detailed information about the issue you’re experiencing with the PnP React Native SDK when using Apple Sign In.

Here’s a summary of the details you’ve provided for the support team:

Issue Summary:
You are encountering an issue where the browser does not open the second time when attempting to log in using Apple Sign In (JWT) after canceling the first attempt. This behavior does not occur with Google sign-ins.

Initialization Code Snippet:

const web3auth = new Web3Auth(WebBrowser, SecureStore, {
  clientId,
  redirectUrl,
  network: OPENLOGIN_NETWORK.SAPPHIRE_DEVNET,
  loginConfig: {
    google: {
      verifier: "u-social",
      verifierSubIdentifier: "u-google",
      typeOfLogin: "google",
      clientId: process.env.EXPO_PUBLIC_GOOGLE_CLIENT_ID,
    },
    jwt: {
      verifier: "u-social",
      verifierSubIdentifier: "u-apple",
      typeOfLogin: "jwt",
      clientId: process.env.EXPO_PUBLIC_WEB3AUTH_CLIENT_ID,
      jwtParameters: {
        verifierIdField: "email",
        domain: "https://appleid.apple.com",
      },
    },
  },
});

Proposed Action Steps:

  • It may be helpful to check if reinitializing the Web3Auth instance after the first cancelation helps resolve the problem.
  • Additionally, confirm that the login() method is getting called each time without interference from previous attempts.

If you’re able to provide any browser console screenshots that show any relevant logs or if there’s any additional context you could share, that would be beneficial for the support team in diagnosing the issue further.

I hope this helps, and please let me know if you have any other questions or need further assistance!

Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.