Uprading from @web3auth/react-native-sdk 3.5.0 to 4.0.0

Please provide the following details too when asking for help in this category:

  • SDK Version: 4.0.0
  • Expo or Bare Version: “expo”: “~48.0.18”,
  • Screenshots of error:
    After the login proceeding, it seems to redirect to the scheme of my app so it reloads my app and I’m not logged in
  • Related to Custom Authentication? Please provide the following info too: (Optional)
    • Verifier Name:
    • JWKS Endpoint:
    • Sample idToken(JWT)

Please provide the Web3Auth initialization and login code snippet below:

import Web3Auth, { LOGIN_PROVIDER, OPENLOGIN_NETWORK } from “@web3auth/react-native-sdk”;
import Constants, { AppOwnership } from “expo-constants”;
import * as Linking from “expo-linking”;
import * as SecureStore from “expo-secure-store”;
import * as WebBrowser from “expo-web-browser”;

const resolvedRedirectUrl =
Constants.appOwnership === AppOwnership.Expo || Constants.appOwnership === AppOwnership.Guest
? Linking.createURL(“web3auth”, {})
: Linking.createURL(“web3auth”, { scheme: “myapp” });

const clientId = REACT_APP_CLIENT_ID;

const SdkInitParams = {
clientId,
network: OPENLOGIN_NETWORK.TESTNET,
useCoreKitKey: false,
sessionTime: 3600, // 1 hour in seconds
whiteLabel: {
name: ‘myapp’,
logoLight: ‘…/assets/images/logo.png’,
logoDark: ‘…/assets/images/logo.png’,
defaultLanguage: ‘en’,
dark: true,
theme: {
primary: ‘#777’,
},
},
};

const web3auth = new Web3Auth(WebBrowser, SecureStore, SdkInitParams);

const login = async (platform) => {
try {
const info = await web3auth.login({
loginProvider:
platform === ‘APPLE’
? LOGIN_PROVIDER.APPLE
: platform === ‘LINKEDIN’
? LOGIN_PROVIDER.LINKEDIN
: LOGIN_PROVIDER.GOOGLE,
redirectUrl: resolvedRedirectUrl,
mfaLevel: ‘none’,
curve: ‘secp256k1’,
sessionTime: 86400, // 1 day in seconds
max_age: 86400, // 1 day in seconds
});
}
};

@phillhorae Welcome Aboard!

You can follow this guide for migration PnP React Native SDK - v3 to v4 | Documentation | Web3Auth

Could you please elaborate the issue? Are you getting any errors?

Hello, thanks for the migration guide, it worked adding all that :

  • Making the prebuild
  • Adding the global.js file
  • Adding the metro.config.js (I had a babel.config.js before)
  • Adding a web3auth.init() before the login
  • Getting the private key from the getter web3auth.privKey

Thanks again for your reactivity !

2 Likes