How to set redirect url dynamically?

In my nft web application, users can log in in two different ways. The first is through a separate page at localhost:3000/login.
When logging in is complete, the page it goes to https://localhost:3000/.
It's operating smoothly.

The second is that if a user visits an assets page (for instance, https://localhost:3000/newNFT/x123) without logging in and then attempts to do an action that requires logging in, a login box is displayed (instead of redirecting to login page)

After login is successful it goes the home page at https://localhost:3000/.
But in this instance, I want the redirect to the page when he browsed without logging in example https://localhost:3000/newNFT/x123.

How can I fix this issue.



Originally posted by: raj2k00

Check the discussion at: https://github.com/orgs/Web3Auth/discussions/406