Middleware
You are able to use the middleware either globally or on a per-page basis.
Per Page Usage
<script lang="ts" setup>
definePageMeta({
middleware: ['auth']
});
</script>
Global Usage
export default defineNuxtConfig({
modules: [
'@nuxt-alt/auth'
],
auth: {
globalMiddleware: true
}
});
To disable auth on a page when set globally you can set this to:
<script lang="ts" setup>
definePageMeta({
auth: false
});
</script>
or to set it as a guest page:
<script lang="ts" setup>
definePageMeta({
auth: 'guest'
});
</script>