[Archive] Routing error in Next.js (uxMode is set to redirect)

:classical_building: Archived Content from Web3Auth Community

This topic was originally posted by bjkim on 6/28/2023.
This content has been migrated from our previous community forum to preserve valuable discussions.


We had a routing problem in our project, so we tested it on the demo app to see if the same thing happened.
​
Based on the code implemented by web3auth, only uxMode was set to Redirect.

At this time, if I move the router through the Link component and go back again, routing does not work.

Codes added in the demo app

  • Create Dashboard Page(sample page)

  • Insert Link Component(go to dashboard)

    <Link href="/dashboard">
       Go To Dashboard
    </Link>
    
  • Uxmode is set to redirect

    const openloginAdapter = new OpenloginAdapter({
       privateKeyProvider,
       adapterSettings:{
          uxMode:'redirect'
       }
    });
    

Here’s a video on that issue. ==> *Issue Video


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

  • SDK Version: v6.1.1 (@web3auth/no-modal)
  • Platform: Web Chrome / Safari

Please provide the Web3Auth initialization and login code snippet below:

I faced the same problem in my environment.
(My environment has a slightly older SDK version than the one you reported…)

The following issue describes the problem and the workaround.

Hi @bjkim, I have raised the issue to the product team. We will get back to you in a while.
Thank you for your input, @s-nakamatsu. I’ll make sure to point them to the issue raised.

Hey @s-nakamatsu, please try the same example out with the latest version of the SDK. let me know if the issue persists for you.

I have updated Web3Auth to v6.1.1 and the situation appears to have worsened.

At the time I run web3auth.init(), window.history.state is now null and I get the back button issue even when not logged in.

image
image2564×780 33.7 KB

Of course, the back button problem remains after login as well.

Here is a sample application that I checked.

Hey @s-nakamatsu

Thanks for raising this. We are looking into this issue internally and will try to get back to you with a solution asap.

@s-nakamatsu @bjkim Please update to the latest SDK since the nextJS routing issue was fixed with v6.1.6

I confirmed that the issue was fixed with v6.1.6

Thank you for your response!

After I also updated, it works fine.