Redirect new user to dynamic URL #530
Replies: 4 comments 1 reply
-
| I don't know if this is the most effective way, but the signin method takes a callback Url as the second parameter. After the user signs up and you're signing him in for the first time, you could grab your  See: https://next-auth.js.org/getting-started/client#specifying-a-callbackurl | 
Beta Was this translation helpful? Give feedback.
-
| I'm faced with this exact scenario. My current workaround redirects to the dynamic route when there is a session. The problem with this implementation is, on a slow network, the login page still displays for a few minutes before useEffect takes effect. | 
Beta Was this translation helpful? Give feedback.
-
| Hi guys I've had this issue, the solution for this is to use absolute URL's like so: 
 You can use Node variables if you want to make it dynamic between your dev, test or production mode. 
 (It is because nextauthjs make a redirect and not and asynchornous call and you need to specify the absolute path) | 
Beta Was this translation helpful? Give feedback.
-
| The callback function is one option, bit there is also a  https://next-auth.js.org/configuration/pages The URL for the page is static but it could be an API endpoint which simply gets the User ID (e.g. an API endpoint that calls  | 
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Your question
What is the most effective way to redirect a new user to a dynamic route?
What are you trying to do
Source
idfrom a database or API and redirect newly registered users topages/post/[id]/index.json first login.Documentation feedback
Beta Was this translation helpful? Give feedback.
All reactions