you would have to set your jwt as a http only cookie at login time but if you have cookies set against "/" with an expiry time then next will have access to it when the page fetches. so you should have the ability to use a utility function in your page code to redirect if the token does not exist. (either in server side props for page router OR in server component for app dir(next13))
Keep the trpc content going please! 👌
This method protects data from an unauthorized user but it doesn't prevent the user from accessing the page. How do you solve that?
you would have to set your jwt as a http only cookie at login time but if you have cookies set against "/" with an expiry time then next will have access to it when the page fetches. so you should have the ability to use a utility function in your page code to redirect if the token does not exist. (either in server side props for page router OR in server component for app dir(next13))
Another banger! Ty gotta keep them trpc route burglars away lol!
thank you