Learn Auth Redirect Next.js

If we open a page and it is not logged in, it will show a full page loader, then when it is fully rendered, useEffect will run and push to home page.

The blocked-unhandled will show the case when not using full page loader, and it will flash the content

Check out this blog post for explanation
{
  "isAuthenticated": false
}
{
  "error": "you are logged out, and there is no user object, and no token"
}

Setting up token, if you add token, then you are considered logged in even in a new tab

List of page (using Next.js Link), will authorized if login (token & no token):

Try to directly go to (will open a new tab), will only authorized if using token: