Google Login Redirect Issue with @web3auth/mpc-core-kit in Next.js

I am using Google login with @web3auth/mpc-core-kit (version ^3.2.4) in my Next.js application and have implemented the redirect method. However, the page does not redirect as expected. Instead, it shows the error screen attached below.

Here’s what I’ve already done:

  1. Created a redirect page and a service worker in my Next.js app.
  2. Added the authorized redirect path in the Google Developer Console settings.

Despite these configurations, the issue persists.

How can I resolve this issue?
If there are additional configurations required in mpc-core-kit, Google Developer Console, or my Next.js app, I would appreciate detailed steps to fix this.

Hi Chintan!

Thank you for reaching out and providing detailed information about your issue. Here’s what I gathered from your message:

  • SDK Details: MPC Core Kit SDK
  • SDK Version: ^3.2.4
  • Platform: Next.js
  • Issue: Google Login Redirect Issue
  • Error Screenshot: Attached (though unable to view the image directly here)

You’ve already taken great steps by creating a redirect page and configuring the redirect path in the Google Developer Console.

To help you further with the redirect issue, could you please share the following additional details?

  1. Web3Auth initialization code snippet and login code snippet, if available.
  2. Any relevant console errors you might have seen besides the error screen shared in the image.

Sometimes the issue could be related to the way the Google Developer Console is set up or the way the redirect page is constructed in Next.js. Double-check that the redirect URI is precisely the same as specified in your code and the Developer Console.

Once we have the code snippets and any additional error messages, I can help troubleshoot this further!

Looking forward to your response!

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.

According to the documentation ([Web3Auth Redirect Mode], I removed the serviceworker/redirect page in my Next.js app and instead used an auth page for redirection as recommended. However, when I click “Login,” it still attempts to redirect to the serviceworker/redirect path.

I have already added the serviceworker/redirect page in my Next.js app, but it continues to display the error screen mentioned above.

How can I resolve this issue and ensure the correct redirection behavior?

@w3abot any update ?

Hey @limbachiyachintan500 our team is looking into the issue, also since you are an enterprise client, do we have a TG group? We should a TG group in case if we don’t have. You can ask the questions, and doubts there for faster resolutions.

1 Like

Hey @limbachiyachintan500

Please wrap your init code inside the following code block.

if (coreKitInstance.status === COREKIT_STATUS.NOT_INITIALIZED) {
  await coreKitInstance.init();
}