[Archive] When trying to login, getting the following error: `[TypeError: Cannot set property 'sessionKey' of undefined]`

:classical_building: Archived Content from Web3Auth Community

This topic was originally posted by abhishek on 8/4/2023.
This content has been migrated from our previous community forum to preserve valuable discussions.


When trying to login, getting the following error:
[TypeError: Cannot set property 'sessionKey' of undefined]

**Web3Auth initialization and login code snippet: **

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

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

const clientId =
“BFfDDu0Ba-UOQVhKbbEB9hLA4U03HkUCCUTSGrkCDv9mF0JaYa40CKg42KPsj1ZLy5rklMd9G4Hdl0LFFp1inh8”;

const login = useCallback(async () => {
try {
const web3auth = new Web3Auth(WebBrowser, SecureStore, {
clientId,
network: OPENLOGIN_NETWORK.TESTNET,
});

  await web3auth.login({
    loginProvider: LOGIN_PROVIDER.GOOGLE,
    useCoreKitKey: false,
    redirectUrl: resolvedRedirectUrl,
    curve: "ed25519",
  });
} catch (error) {
  console.log("error: ", error);
}

}, );

@abhishek Thanks for reaching out.

Your issue has been forwarded to our team and we will get back with further updates once more information becomes available.

Can you share a screenshot of the entire console logs?

LOG error: [TypeError: Cannot set property ‘sessionKey’ of undefined]

any updates on this @vjgee ?

Your issue has been forwarded to our team and as soon as I hear from them, I will provide an update. In the meantime, have you gone through this troubleshooting guide?

You need to call await web3auth.init() before calling web3auth.login()

thanks!! totally missed this.