React Native Plug&Play: get differents privKey on android/ios

I am using web3auth plug&play on my React Native App, I get different privKey with a same google account on android/ios (same clientid, same network)

Is that correct ? if privKey is not consistency between android/ios, is it consistency between other device (if I use another ios device, will I get same key as previous one ?)

To obtain the same key across devices, please use the same combination in both.

  1. Same web3auth network. e.g., cyan
  2. Same client ID.
  3. Same verifier details
  4. Same login method.

thanks for your answer, I still have a questions About gettings diff privKey between IOS/Android with same web3auth client id/ network/ login method, is it normal ?

Which SDK are you using ? Have you specified the same verifier details in your code ? To ensure that you get the same keys, you need to use the same verifier in your code as well.

I am using @web3auth/react-native-sdk v4.0.0, default plug&play option. It’s React Native, js codebase 100% shared between ios/android, I use everything the same, I do not have any specific code for each platform in this feature.

Thanks for confirming.

I have fowarded your issue to our team and will get back with further updates once more information becomes available.

Please share your Web3Auth specific implementation code.

1 Like

Hi, thanks for your response, here is my code
first I create web3auth instance, and init()

import * as WebBrowser from "@toruslabs/react-native-web-browser";
import EncryptedStorage from "react-native-encrypted-storage";

import Web3Auth from "@web3auth/react-native-sdk";

export const web3auth = new Web3Auth(WebBrowser, EncryptedStorage, {
  clientId: WEB3AUTH_CLIENT_ID,
  network: "testnet",
});

Then I login user with google account, and get privKey

...
await web3auth.login({
      loginProvider: LOGIN_PROVIDER.GOOGLE,
      redirectUrl: resolvedRedirectUrl,
      mfaLevel: MFA_LEVELS.NONE,
      curve: SUPPORTED_KEY_CURVES.ED25519,
    })

 const privateKey = web3auth.privKey;

The privateKey I get is different for same google account, between android/ios, and also differcent between IOS simulator and real iPhone device, I just use default plug&play flow, and only 1 web3auth clientid.

As I see, your code looks fine, can you please try and see if you’re facing the same issue with one of our example apps?

This app might resemble your integration the closest: https://github.com/Web3Auth/web3auth-pnp-examples/tree/main/react-native/rn-bare-quick-start

There might be other configuration issues which might need looking into, let me know if this works.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.