You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It’s likely that your project will have both pages that are publicly available and private ones which should only be available to logged in users. Add this code snippet to pages you would like to protect.
106
+
It’s likely that your project will have both pages that are publicly available and private ones which should only be available to logged in users.
107
+
108
+
Route protection is set up in within the `routeRules` in `nuxt.config.ts`
109
+
110
+
In the below example,
111
+
112
+
-`/**` - This protected all routes redirecting the login route.
113
+
-`/dashboard` - route is protected for users with `admin` permissions.
114
+
-`/public` - this is flagged as a public route and will be open to all visitors.
107
115
108
116
```jsx
109
-
<script setup lang="ts">
110
-
definePageMeta({
111
-
middleware: ['auth-logged-in'],
112
-
})
113
-
</script>
117
+
routeRules: {
118
+
'/**': {
119
+
appMiddleware: ['auth-logged-in'],
120
+
kinde: {
121
+
redirectUrl:'/api/login',
122
+
external:true,
123
+
},
124
+
},
125
+
'/dashboard': {
126
+
appMiddleware: ['auth-logged-in'],
127
+
kinde: {
128
+
// list of permissions that are required to access the route
0 commit comments