--- title: Route Authorization --- # Route Authorization Modern.js defaults to the convention-based routing based on React Router v7. For more details, please refer to [Routing](/guides/basic-features/routes/routes#routing). In a web application, if there are multiple routes, we may need to authorize access to some of them before accessing them. For example, in the following scenario: - Access to the `/` route does not require authorization and can be accessed directly. - Access to the `/protected` route requires authorization. If there is no authorization, it will automatically redirect to the `/login` route. After successful login, it returns to `/protected`. import Sandpack from '@site/src/components/Sandpack'; import srcRoutesPageText from '../../../../src/sandbox/csr-auth/src/routes/page-tsx.txt'; import srcRoutesLayoutText from '../../../../src/sandbox/csr-auth/src/routes/layout-tsx.txt'; import srcRoutesAuthText from '../../../../src/sandbox/csr-auth/src/routes/Auth-tsx.txt'; import srcRoutesFakeAuthText from '../../../../src/sandbox/csr-auth/src/routes/fakeAuth-ts.txt'; import srcRoutesProtectedPageText from '../../../../src/sandbox/csr-auth/src/routes/protected/page-tsx.txt'; import srcRoutesLoginPageText from '../../../../src/sandbox/csr-auth/src/routes/login/page-tsx.txt';