This topic was originally posted by limbachiyachintan500 on 7/10/2024.
This content has been migrated from our previous community forum to preserve valuable discussions.
I am using the MPC Core Kit SDK for Google login but facing a redirect issue. When I click login, it redirects me to select an email and click continue. After that, it redirects and the coreKitStatus shows as INITIALIZED.
i am use nextjs and also i have create a path serviceworker/redirect!!
let coreKitInstance: Web3AuthMPCCoreKit;
let evmProvider: EthereumSigningProvider;
if (typeof window !== ‘undefined’) {
coreKitInstance = new Web3AuthMPCCoreKit({
web3AuthClientId,
web3AuthNetwork: WEB3AUTH_NETWORK.MAINNET,
uxMode: ‘redirect’,
setupProviderOnInit: false, // needed to skip the provider setup
manualSync: true, // This is the recommended approach
});
// Setup provider for EVM Chain
evmProvider = new EthereumSigningProvider({ config: { chainConfig } });
evmProvider.setupProvider(coreKitInstance);
}
// Check coreKit status and handle login state
if (coreKitInstance.status === COREKIT_STATUS.LOGGED_IN) {
dispatch(userevmProvider(evmProvider));
dispatch(UsercoreKitInstance(coreKitInstance));
fetchUserData();
dispatch(setFetchbalace(true));
} else if (coreKitInstance.status === COREKIT_STATUS.INITIALIZED) {
dispatch(setIsLoading(false));
} else if (coreKitInstance.status === COREKIT_STATUS.REQUIRED_SHARE) {
console.log('required more shares, please enter your backup/device factor key');
dispatch(setIsLoading(false));
}
};
init();
}, );
const login = async () => {
try {
if (!coreKitInstance) {
throw new Error(‘initiated to login’);
}
const verifierConfig = {
subVerifierDetails: {
typeOfLogin: 'google',
verifier: 'blok-capital',
clientId: process.env.NEXT_PUBLIC_GOOGLE_ID,
},
} as SubVerifierDetailsParams;
await coreKitInstance.loginWithOauth(verifierConfig);
if (coreKitInstance.status === COREKIT_STATUS.LOGGED_IN) {
await coreKitInstance.commitChanges(); // Needed for new accounts
}
setCoreKitStatus(coreKitInstance.status);
} catch (err) {
console.log(err);
}
Hey, thanks for sharing the code. I’ll try to reproduce the issue and update you. For second issue are you using loginWithJWT, so it seems like your verifier is not expecting email but you are passing sub.
Can you please share the code for the same, and screenshot of verifier from the dashbaord?