main 7d61bff7d053 cached
155 files
296.5 KB
85.0k tokens
76 symbols
1 requests
Download .txt
Showing preview only (334K chars total). Download the full file or copy to clipboard to get everything.
Repository: manchenkoff/nuxt-auth-sanctum
Branch: main
Commit: 7d61bff7d053
Files: 155
Total size: 296.5 KB

Directory structure:
gitextract_4wmesn7w/

├── .github/
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug.yml
│   │   ├── config.yml
│   │   └── feature.yml
│   ├── dependabot.yml
│   ├── pull_request_template.md
│   └── workflows/
│       ├── docs.yml
│       ├── prerelease.yml
│       ├── publish.yml
│       ├── upgrade.yml
│       └── validation.yml
├── .gitignore
├── .nuxtrc
├── .yamlfmt.yaml
├── .yamllint.yaml
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── TROUBLESHOOTING.md
├── docs/
│   ├── .env.example
│   ├── .gitignore
│   ├── .npmrc
│   ├── README.md
│   ├── app/
│   │   ├── app.config.ts
│   │   ├── app.vue
│   │   ├── assets/
│   │   │   └── css/
│   │   │       └── main.css
│   │   ├── components/
│   │   │   ├── AppFooter.vue
│   │   │   ├── AppHeader.vue
│   │   │   ├── AppLogo.vue
│   │   │   ├── OgImage/
│   │   │   │   └── OgImageDocs.takumi.vue
│   │   │   └── content/
│   │   │       ├── HeroBackground.vue
│   │   │       └── StarsBackground.vue
│   │   ├── error.vue
│   │   ├── layouts/
│   │   │   └── docs.vue
│   │   └── pages/
│   │       ├── [...slug].vue
│   │       └── index.vue
│   ├── content/
│   │   ├── 1.getting-started/
│   │   │   ├── .navigation.yml
│   │   │   ├── 1.index.md
│   │   │   └── 2.installation.md
│   │   ├── 2.usage/
│   │   │   ├── 1.configuration.md
│   │   │   ├── 2.cookie.md
│   │   │   ├── 3.token.md
│   │   │   └── 4.proxy.md
│   │   ├── 3.composables/
│   │   │   ├── 1.useSanctumAuth.md
│   │   │   ├── 2.useSanctumUser.md
│   │   │   ├── 3.useSanctumClient.md
│   │   │   ├── 4.useSanctumFetch.md
│   │   │   ├── 5.useLazySanctumFetch.md
│   │   │   ├── 6.useSanctumConfig.md
│   │   │   └── 7.useSanctumAppConfig.md
│   │   ├── 4.middleware/
│   │   │   ├── 1.sanctum-auth.md
│   │   │   ├── 2.sanctum-guest.md
│   │   │   └── 3.global.md
│   │   ├── 5.hooks/
│   │   │   ├── 1.sanctum-request.md
│   │   │   ├── 10.sanctum-proxy-request.md
│   │   │   ├── 2.sanctum-response.md
│   │   │   ├── 3.sanctum-error-request.md
│   │   │   ├── 4.sanctum-error-response.md
│   │   │   ├── 5.sanctum-redirect.md
│   │   │   ├── 6.sanctum-init.md
│   │   │   ├── 7.sanctum-refresh.md
│   │   │   ├── 8.sanctum-login.md
│   │   │   └── 9.sanctum-logout.md
│   │   ├── 6.advanced/
│   │   │   ├── 1.interceptors.md
│   │   │   ├── 2.error-handling.md
│   │   │   ├── 3.logging.md
│   │   │   ├── 4.token-storage.md
│   │   │   ├── 5.dependencies.md
│   │   │   ├── 6.breeze-nuxt-template.md
│   │   │   └── 7.troubleshooting.md
│   │   └── index.md
│   ├── content.config.ts
│   ├── eslint.config.mjs
│   ├── nuxt.config.ts
│   ├── package.json
│   ├── pnpm-workspace.yaml
│   ├── renovate.json
│   └── tsconfig.json
├── eslint.config.mjs
├── package.json
├── playground/
│   ├── app/
│   │   ├── app.vue
│   │   ├── error.vue
│   │   ├── layouts/
│   │   │   └── default.vue
│   │   ├── pages/
│   │   │   ├── index.vue
│   │   │   ├── login.vue
│   │   │   ├── logout.vue
│   │   │   ├── profile.vue
│   │   │   └── welcome.vue
│   │   └── plugins/
│   │       ├── sanctum.hooks.ts
│   │       └── sanctum.storage.client.ts
│   ├── nuxt.config.ts
│   ├── package.json
│   ├── pnpm-workspace.yaml
│   ├── server/
│   │   ├── plugins/
│   │   │   └── sanctum.hooks.ts
│   │   └── tsconfig.json
│   └── tsconfig.json
├── src/
│   ├── config.ts
│   ├── module.ts
│   ├── runtime/
│   │   ├── composables/
│   │   │   ├── useLazySanctumFetch.ts
│   │   │   ├── useSanctumAppConfig.ts
│   │   │   ├── useSanctumAuth.ts
│   │   │   ├── useSanctumClient.ts
│   │   │   ├── useSanctumConfig.ts
│   │   │   ├── useSanctumFetch.ts
│   │   │   ├── useSanctumTokenStorage.ts
│   │   │   └── useSanctumUser.ts
│   │   ├── httpFactory.ts
│   │   ├── interceptors/
│   │   │   ├── index.ts
│   │   │   ├── request/
│   │   │   │   ├── logging.ts
│   │   │   │   ├── params.ts
│   │   │   │   ├── stateful.ts
│   │   │   │   └── token.ts
│   │   │   └── response/
│   │   │       ├── errorHandler.ts
│   │   │       ├── logging.ts
│   │   │       ├── proxy.ts
│   │   │       └── validation.ts
│   │   ├── middleware/
│   │   │   ├── sanctum.auth.ts
│   │   │   ├── sanctum.global.ts
│   │   │   └── sanctum.guest.ts
│   │   ├── plugin.ts
│   │   ├── server/
│   │   │   ├── api/
│   │   │   │   └── proxy.ts
│   │   │   └── augments.server.d.ts
│   │   ├── storages/
│   │   │   └── cookieTokenStorage.ts
│   │   ├── types/
│   │   │   ├── config.ts
│   │   │   ├── fetch.ts
│   │   │   ├── meta.ts
│   │   │   └── options.ts
│   │   └── utils/
│   │       ├── constants.ts
│   │       ├── credentials.ts
│   │       ├── formatter.ts
│   │       ├── logging.ts
│   │       ├── runtime.ts
│   │       └── session.ts
│   └── templates.ts
├── test/
│   ├── helpers/
│   │   ├── constants.ts
│   │   └── mocks.ts
│   └── unit/
│       ├── config.test.ts
│       ├── constants.test.ts
│       ├── credentials.test.ts
│       ├── formatter.test.ts
│       ├── interceptors/
│       │   ├── request/
│       │   │   ├── logging.test.ts
│       │   │   ├── params.test.ts
│       │   │   ├── stateful.test.ts
│       │   │   └── token.test.ts
│       │   └── response/
│       │       ├── errorHandler.test.ts
│       │       ├── logging.test.ts
│       │       ├── proxy.test.ts
│       │       └── validation.test.ts
│       ├── logging.test.ts
│       └── runtime.test.ts
├── tsconfig.json
└── vitest.config.ts

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/FUNDING.yml
================================================
github: manchenkoff
thanks_dev: manchenkoff
buy_me_a_coffee: manchenkoff
tidelift: npm/nuxt-auth-sanctum


================================================
FILE: .github/ISSUE_TEMPLATE/bug.yml
================================================
name: Bug Report
description: Report a bug or incorrect behaviour
title: "[bug] name"
labels: bug
assignees: manchenkoff
body:
  - id: problem_statement
    type: textarea
    attributes:
      label: Describe the bug
      description: Provide a clear and concise description of the bug
      placeholder: The feature X might be broken when I do Y
    validations:
      required: true
  - id: expected_behaviour
    type: textarea
    attributes:
      label: Expected behaviour
      description: Provide a clear description of what you expected to happen
      placeholder: When I do X, I expect Y to happen
    validations:
      required: true
  - id: actual_behaviour
    type: textarea
    attributes:
      label: Actual behaviour
      description: Provide a concise description of what actually happened
      placeholder: When I do X, Y happens instead
    validations:
      required: true
  - id: runtime
    type: dropdown
    attributes:
      label: Runtime
      description: Choose affected runtimes
      options:
        - Client side (CSR)
        - Server side (SSR)
        - Both
      default: 0
    validations:
      required: true
  - id: environment
    type: dropdown
    attributes:
      label: Environment
      description: Choose affected environments
      options:
        - Development (local)
        - Production
        - Both
      default: 1
    validations:
      required: true
  - id: reproduction
    type: textarea
    attributes:
      label: Reproduction steps
      description: |
        Please explain how to reproduce the bug,
        ideally with a minimal code example or repository
      placeholder: |
        1. Do X
        2. Do Y
        3. See Z happening
    validations:
      required: false
  - id: nuxt_version
    type: input
    attributes:
      label: Nuxt version
      description: Version of the Nuxt framework
      placeholder: 4.2.1
    validations:
      required: true
  - id: module_version
    type: input
    attributes:
      label: Module version
      description: Version of the module installed
      placeholder: 1.0.1
    validations:
      required: true
  - id: config_example
    type: textarea
    attributes:
      label: Module config
      description: Provide your `nuxt.config.ts` contents
      render: typescript
    validations:
      required: false
  - type: upload
    id: file_upload
    attributes:
      label: File Upload
      description: Attach a file to this issue (screenshot, log file, etc.)
    validations:
      required: false
  - id: investigation
    type: checkboxes
    attributes:
      label: Initial investigation
      options:
        - label: I have checked the documentation, no solution found
          required: true
        - label: I have checked the troubleshooting guide, did not help
          required: true


================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false


================================================
FILE: .github/ISSUE_TEMPLATE/feature.yml
================================================
name: Feature Request
description: Suggest an idea for this project
title: "[feature] name"
labels: enhancement
assignees: manchenkoff
body:
  - id: feature_description
    type: textarea
    attributes:
      label: Describe the feature
      description: Provide a detailed description of the functionality
      value: |
        It would be nice to have a way to ...
    validations:
      required: true
  - id: proposed_solution
    type: textarea
    attributes:
      label: Proposed solution
      description: Describe the solution you would like to see
      placeholder: I think this can be implemented in the way...
    validations:
      required: false
  - id: alternative_solution
    type: textarea
    attributes:
      label: Alternatives
      description: Describe alternatives you have considered
      placeholder: Another option would be...
    validations:
      required: false
  - id: ready_to_contribute
    type: checkboxes
    attributes:
      label: Do you want to contribute?
      description: |
        Check this box if you are happy to implement this yourself
        once we have a plan
      options:
        - label: "Yes"
          required: false


================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
  - package-ecosystem: "npm"
    directory: "/"
    schedule:
      interval: "monthly"


================================================
FILE: .github/pull_request_template.md
================================================
**Describe the problem and solution**

Closes #XXX.

REPLACE_THIS_WITH_YOUR_DESCRIPTION


================================================
FILE: .github/workflows/docs.yml
================================================
name: Nuxt [Docs]
env:
  node_version: 24
concurrency:
  group: "pages"
  cancel-in-progress: false
on:
  push:
    branches: ["main"]
    paths: ["docs/**"]
  workflow_dispatch:
permissions:
  contents: read
  pages: write
  id-token: write
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Install pnpm
        uses: pnpm/action-setup@v5
      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: ${{ env.node_version }}
          cache: pnpm
      - name: Install dependencies
        working-directory: ./docs
        run: pnpm install
      - name: Validate
        working-directory: ./docs
        run: pnpm lint
      - name: Generate documentation
        run: pnpm generate
        working-directory: ./docs
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v4
        with:
          path: ./docs/.output/public
  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v5


================================================
FILE: .github/workflows/prerelease.yml
================================================
name: Nuxt [Pre-Release]
env:
  node_version: 24
  node_registry: https://registry.npmjs.org/
  changelog_user: Github CI
  changelog_email: artem@manchenkoff.me
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
concurrency:
  group: nuxt-auth-sanctum-prerelease
  cancel-in-progress: false
permissions:
  contents: write
  id-token: write
on: workflow_dispatch
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Install pnpm
        uses: pnpm/action-setup@v5
      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: ${{ env.node_version }}
          cache: pnpm
      - name: Install dependencies
        run: pnpm install
      - name: Prepare stubs
        run: pnpm dev:prepare
      - name: Validate package
        run: pnpm validate
  publish:
    runs-on: ubuntu-latest
    needs: lint
    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          fetch-depth: 0
      - name: Install pnpm
        uses: pnpm/action-setup@v5
      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: ${{ env.node_version }}
          registry-url: ${{ env.node_registry }}
          cache: pnpm
      - name: Install dependencies
        run: pnpm install
      - name: Prepare stubs
        run: pnpm dev:prepare
      - name: Build
        run: pnpm prepack
      - name: Generate changelog and publish release
        run: |-
          git config --global user.name "${{ env.changelog_user }}"
          git config --global user.email "${{ env.changelog_email }}"
          pnpm changelogen --release --push \
            --publish --prerelease --publishTag beta


================================================
FILE: .github/workflows/publish.yml
================================================
name: Nuxt [Release]
env:
  node_version: 24
  node_registry: https://registry.npmjs.org/
  changelog_user: Github CI
  changelog_email: artem@manchenkoff.me
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
concurrency:
  group: nuxt-auth-sanctum-release
  cancel-in-progress: false
permissions:
  contents: write
  id-token: write
on: workflow_dispatch
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Install pnpm
        uses: pnpm/action-setup@v5
      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: ${{ env.node_version }}
          cache: pnpm
      - name: Install dependencies
        run: pnpm install
      - name: Prepare stubs
        run: pnpm dev:prepare
      - name: Validate package
        run: pnpm validate
  publish:
    runs-on: ubuntu-latest
    needs: lint
    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          fetch-depth: 0
      - name: Install pnpm
        uses: pnpm/action-setup@v5
      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: ${{ env.node_version }}
          registry-url: ${{ env.node_registry }}
          cache: pnpm
      - name: Install dependencies
        run: pnpm install
      - name: Prepare stubs
        run: pnpm dev:prepare
      - name: Build
        run: pnpm prepack
      - name: Generate changelog and publish release
        run: |-
          git config --global user.name "${{ env.changelog_user }}"
          git config --global user.email "${{ env.changelog_email }}"
          pnpm changelogen --release --push --publish


================================================
FILE: .github/workflows/upgrade.yml
================================================
name: Upgrade Dependencies

env:
  node_version: 24
  git_email: artem@manchenkoff.me
  git_name: manchenkoff

on:
  workflow_dispatch:
  schedule:
    - cron: "0 0 * * 0"

jobs:
  upgrade:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
    strategy:
      fail-fast: false
      matrix:
        project: [".", "docs", "playground"]
    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: ${{ env.node_version }}

      - name: Enable corepack
        run: corepack enable

      - name: Install dependencies
        working-directory: ${{ matrix.project }}
        run: npx nypm@latest i

      - name: Upgrade
        working-directory: ${{ matrix.project }}
        run: pnpm upgrade

      - name: Check for changes
        id: changed
        run: |
          echo "DATE=$(date +%Y-%m-%d)" >> $GITHUB_ENV
          PROJECT_NAME="${{ matrix.project }}"
          if [ "$PROJECT_NAME" = "." ]; then
            PROJECT_NAME="root"
          fi
          echo "project_name=$PROJECT_NAME" >> $GITHUB_ENV
          if git diff --quiet; then
            echo "changed=false" >> $GITHUB_OUTPUT
          else
            echo "changed=true" >> $GITHUB_OUTPUT
          fi

      - name: Configure git
        if: steps.changed.outputs.changed == 'true'
        run: |
          git config --global user.email "${{ env.git_email }}"
          git config --global user.name "${{ env.git_name }}"

      - name: Create branch and commit
        if: steps.changed.outputs.changed == 'true'
        run: |
          BRANCH="deps/bump-${DATE}-${{ env.project_name }}"
          git checkout -b "$BRANCH"
          git add -A
          git commit -m "chore: upgrade ${{ env.project_name }} dependencies"

      - name: Push changes
        if: steps.changed.outputs.changed == 'true'
        run: |
          BRANCH="deps/bump-${DATE}-${{ env.project_name }}"
          git push origin :$BRANCH || true
          git push -u origin HEAD

      - name: Create Pull Request
        if: steps.changed.outputs.changed == 'true'
        run: |
          gh pr create \
            --base main \
            --head deps/bump-${DATE}-${{ env.project_name }} \
            --title "deps: ${{ env.project_name }} weekly dependency bump" \
            --body "Automated dependency upgrade for ${{ env.project_name }}. Please review before merging." \
            --assignee manchenkoff
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


================================================
FILE: .github/workflows/validation.yml
================================================
name: Nuxt [Validate]
env:
  node_version: 24
concurrency:
  group: nuxt-auth-sanctum-ci
  cancel-in-progress: false
on:
  workflow_dispatch:
  pull_request:
    branches: [main]
permissions:
  contents: read
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Install pnpm
        uses: pnpm/action-setup@v5
      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: ${{ env.node_version }}
          cache: pnpm
      - name: Install dependencies
        run: pnpm install
      - name: Build stubs
        run: pnpm dev:prepare
      - name: Lint
        run: pnpm lint
      - name: Type check
        run: pnpm test:types
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Install pnpm
        uses: pnpm/action-setup@v5
      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: ${{ env.node_version }}
          cache: pnpm
      - name: Install dependencies
        run: pnpm install
      - name: Build stubs
        run: pnpm dev:prepare
      - name: Test
        run: pnpm test


================================================
FILE: .gitignore
================================================
# Dependencies
node_modules

# Logs
*.log

# Temp directories
.temp
.tmp
.cache

# Yarn
**/.yarn/cache
**/.yarn/*state*

# Generated dirs
dist

# Nuxt
.nuxt
.output
.data
.vercel_build_output
.build-*
.netlify

# Env
.env

# Testing
reports
coverage
*.lcov
.nyc_output

# VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Intellij idea
*.iml
.idea

# OSX
.DS_Store
.AppleDouble
.LSOverride
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


================================================
FILE: .nuxtrc
================================================
setups.@nuxt/test-utils="4.0.2"

================================================
FILE: .yamlfmt.yaml
================================================
# https://github.com/google/yamlfmt/blob/main/docs/config-file.md
formatter:
  type: basic
  include_document_start: false


================================================
FILE: .yamllint.yaml
================================================
# https://yamllint.readthedocs.io/en/stable/rules.html
extends: default
rules:
  document-start:
    present: false
  truthy: false


================================================
FILE: CHANGELOG.md
================================================
# Changelog


## v2.3.4

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v2.3.3...v2.3.4)

### 🩹 Fixes

- Use correct config in logger and improve docs about env overrides ([#605](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/605))

### 📖 Documentation

- Clarify SSR environment variable requirements for baseUrl ([#595](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/595))

### 🏡 Chore

- **test:** Added module unit tests ([#602](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/602))

### ❤️ Contributors

- Artem Manchenkov ([@manchenkoff](https://github.com/manchenkoff))
- Derrick Obedgiu <derrickobedgiu@gmail.com>

## v2.3.3

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v2.3.2...v2.3.3)

### 🩹 Fixes

- **proxy:** Use runtime-agnostic readRawBody for multipart file uploads ([#582](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/582))

### 🏡 Chore

- **ci:** Upgraded action versions ([daffcee](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/daffcee))

### ❤️ Contributors

- Derrick Obedgiu <derrickobedgiu@gmail.com>
- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v2.3.2

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v2.3.1...v2.3.2)

### 🩹 Fixes

- Fallback to default token storage in both csr and ssr ([#580](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/580))
- Allow partial override for runtime config ([#579](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/579))
- Deduplicate fetch requests using key ([#581](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/581))

### 🏡 Chore

- Upgraded nuxt and content setup ([ad62713](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/ad62713))
- Upgraded nuxt and content setup ([bb7e9a2](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/bb7e9a2))

### ❤️ Contributors

- Artem Manchenkov ([@manchenkoff](https://github.com/manchenkoff))
- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v2.3.1

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v2.3.0...v2.3.1)

### 🩹 Fixes

- Typo in Configuration.md ([#569](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/569))

### 🏡 Chore

- Updated issue templates ([53a4323](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/53a4323))
- Added error logs for debugging ([#570](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/570))

### ❤️ Contributors

- Artem Manchenkov ([@manchenkoff](https://github.com/manchenkoff))
- EtienneHosman ([@EtienneHosman](https://github.com/EtienneHosman))
- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v2.3.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v2.2.0...v2.3.0)

### 🚀 Enhancements

- Added token storage hook ([#553](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/553))
- Split server and client configs ([#552](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/552))

### ❤️ Contributors

- Artem Manchenkov ([@manchenkoff](https://github.com/manchenkoff))

## v2.2.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v2.1.3...v2.2.0)

### 🚀 Enhancements

- Sanitize proxy request headers to exclude hop-by-hop ([#525](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/525))

### 📖 Documentation

- Added plugin-based approach for token storage ([#539](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/539))

### 🏡 Chore

- **deps-dev:** Bump @types/node from 25.1.0 to 25.3.3 ([#534](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/534))
- **deps-dev:** Bump @nuxt/kit from 4.2.2 to 4.3.1 ([#537](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/537))
- **deps-dev:** Bump nuxt from 4.3.0 to 4.3.1 ([#538](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/538))
- **deps-dev:** Bump @nuxt/test-utils from 3.23.0 to 4.0.0 ([#535](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/535))
- **deps-dev:** Bump @nuxt/devtools from 3.1.1 to 3.2.2 ([#536](https://github.com/manchenkoff/nuxt-auth-sanctum/pull/536))

### ❤️ Contributors

- Ahoiroman <roman.lossin@icloud.com>
- Artem Manchenkov ([@manchenkoff](https://github.com/manchenkoff))

## v2.1.3

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v2.1.2...v2.1.3)

### 🩹 Fixes

- **proxy:** Prevent readBody crash on empty DELETE requests ([2ef0977](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/2ef0977))

### 🏡 Chore

- **deps-dev:** Bump @types/node from 25.0.9 to 25.1.0 ([888afbe](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/888afbe))
- **deps-dev:** Bump @nuxt/schema from 4.2.2 to 4.3.0 ([dadb7ab](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/dadb7ab))
- **deps-dev:** Bump vitest from 4.0.17 to 4.0.18 ([2b8df57](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/2b8df57))
- **deps-dev:** Bump vue-tsc from 3.2.2 to 3.2.4 ([14f3b99](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/14f3b99))
- **deps-dev:** Bump nuxt from 4.2.2 to 4.3.0 ([327ac03](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/327ac03))
- Fix lints ([7d13b94](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/7d13b94))

### ❤️ Contributors

- Derrick Obedgiu <derrickobedgiu@gmail.com>

## v2.1.2

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v2.1.1...v2.1.2)

### 🩹 Fixes

- Do not read body on multipart requests ([fcbff01](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/fcbff01))

### 🏡 Chore

- Bump packages ([dda16b8](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/dda16b8))
- Bump packages ([15dc3b5](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/15dc3b5))
- Added certificated.dev banner ([e951e56](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/e951e56))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v2.1.1

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v2.1.0...v2.1.1)

### 🩹 Fixes

- Use new release pipeline workflow ([0beadd5](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/0beadd5))
- **proxy:** Use runtime-agnostic readBody for v8-engine compatibility ([47d6523](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/47d6523))

### ❤️ Contributors

- Derrick Obedgiu <derrickobedgiu@gmail.com>
- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v2.1.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v2.0.0...v2.1.0)

### 🚀 Enhancements

- Added server hook for proxy request ([1ac5481](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/1ac5481))

### 🏡 Chore

- Minor refactoring for proxy endpoint ([8074e14](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/8074e14))
- Added playground example for nitro hook plugin ([dbd2b85](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/dbd2b85))
- **docs:** Added description for proxy hook ([dd2d1ce](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/dd2d1ce))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v2.0.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.4.3...v2.0.0)

### 🚀 Enhancements

- Add optional fetch options to login/logout methods ([981d5cc](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/981d5cc))
- ⚠️  Migrate to useFetch composable ([25f9af5](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/25f9af5))
- ⚠️  Removed checkSession from public scope ([ac34929](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/ac34929))

### 🏡 Chore

- **deps-dev:** Bump vue from 3.5.24 to 3.5.25 ([7700fa7](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/7700fa7))
- **deps-dev:** Bump vitest from 4.0.13 to 4.0.14 ([f9474dd](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/f9474dd))
- **deps-dev:** Bump @nuxt/eslint-config from 1.10.0 to 1.11.0 ([3a24c01](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/3a24c01))
- **deps-dev:** Bump @nuxt/devtools from 3.1.0 to 3.1.1 ([d7e0f2b](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/d7e0f2b))
- **docs:** Updated info about useSanctumAuth composable ([34c54c7](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/34c54c7))
- **docs:** Updated info about useSanctumAuth composable ([f092852](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/f092852))
- **docs:** Adjusted composables description ([8c958e2](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/8c958e2))

#### ⚠️ Breaking Changes

- ⚠️  Migrate to useFetch composable ([25f9af5](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/25f9af5))
- ⚠️  Removed checkSession from public scope ([ac34929](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/ac34929))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.4.3

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.4.2...v1.4.3)

### 🏡 Chore

- **deps-dev:** Bump @nuxt/devtools from 2.7.0 to 3.0.1 ([ae873cf](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/ae873cf))
- **docs:** Updated readme ([a68d9a6](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/a68d9a6))
- Remove outdated type augmentation ([5df0223](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/5df0223))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.4.2

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.4.1...v1.4.2)

## v1.4.1

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.4.1-4...v1.4.1)

### 🩹 Fixes

- Avoid memory leak on session check and prevent infinite loop ([0d7ca68](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/0d7ca68))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.4.1-4

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.4.1-3...v1.4.1-4)

### 🩹 Fixes

- Move session check outside of composable ([5d7e52a](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/5d7e52a))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.4.1-3

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.4.1-2...v1.4.1-3)

### 🩹 Fixes

- Disable session check ([745ed5a](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/745ed5a))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.4.1-2

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.4.1-1...v1.4.1-2)

### 🩹 Fixes

- Enable reactive resolver for fetch key ([6daa5d4](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/6daa5d4))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.4.1-1

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.4.1-0...v1.4.1-1)

### 🩹 Fixes

- Enable cookie check without reactivity ([68e13fd](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/68e13fd))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.4.1-0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.4.0...v1.4.1-0)

### 🩹 Fixes

- Use raw data for serialization and disable session check ([11523c2](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/11523c2))

### 🏡 Chore

- **docs:** Updated website url ([848e0f9](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/848e0f9))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.4.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.3.1...v1.4.0)

### 🚀 Enhancements

- Added reactive for useAsyncData behind sanctumFetch ([bd94165](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/bd94165))
- Added reactive url for useAsyncData behind sanctumFetch ([b471100](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/b471100))

### 📖 Documentation

- Improved nuxt content configuration and updated docs ([bf7d2e8](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/bf7d2e8))

### 🏡 Chore

- **deps-dev:** Bump vue-tsc from 2.2.12 to 3.1.0 ([6401d22](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/6401d22))
- **docs:** Fixed typo ([90b6565](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/90b6565))
- Added yaml linter configs ([19589d0](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/19589d0))
- **ci:** Trigger docs deployment only if changed ([c202bc3](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/c202bc3))
- **docs:** Added section abour reactivity for fetch key/url ([81c2ca2](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/81c2ca2))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.3.1

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.3.0...v1.3.1)

### 🩹 Fixes

- Resolve reactive options in useAsyncData ([95b3166](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/95b3166))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.3.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.2.0...v1.3.0)

### 🚀 Enhancements

- Check session existence in middleware ([217c60e](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/217c60e))

### 🏡 Chore

- **deps-dev:** Bump nuxt in the npm_and_yarn group across 1 directory ([146faed](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/146faed))

### 🤖 CI

- Simplify publish release ([e2c8fe5](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/e2c8fe5))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.2.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.1.2...v1.2.0)

### 🚀 Enhancements

- Support user-defined fetch key ([b124fa8](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/b124fa8))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.1.2

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.1.1...v1.1.2)

### 🩹 Fixes

- Handle no connection error ([5b9bb04](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/5b9bb04))

### 🏡 Chore

- **deps-dev:** Bump @nuxt/schema from 4.0.1 to 4.0.2 ([e0f12bd](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/e0f12bd))
- **deps-dev:** Bump eslint from 9.31.0 to 9.32.0 ([66f5de9](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/66f5de9))
- **deps-dev:** Bump @nuxt/module-builder from 1.0.1 to 1.0.2 ([f6f6d01](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/f6f6d01))
- **deps-dev:** Bump @nuxt/eslint-config from 1.7.0 to 1.7.1 ([e48a4be](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/e48a4be))
- **deps-dev:** Bump @nuxt/kit from 4.0.1 to 4.0.2 ([206a7c5](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/206a7c5))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.1.1

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.1.0...v1.1.1)

### 🩹 Fixes

- Upgraded vulnerable package ([fd4acf1](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/fd4acf1))

### 🏡 Chore

- Upgraded to nuxt 4 ([34450d7](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/34450d7))
- Bump packages ([2155122](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/2155122))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.1.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.0.1...v1.1.0)

### 🚀 Enhancements

- Allow login without fetching an identity ([55df80c](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/55df80c))
- Hide serverProxy endpoint from runtime config ([a730c4c](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/a730c4c))

### 🩹 Fixes

- Proxy request without reading ([18b6105](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/18b6105))

### 🏡 Chore

- **deps-dev:** Bump @types/node from 22.15.32 to 24.0.8 ([c193a81](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/c193a81))
- **deps-dev:** Bump @nuxt/devtools from 2.5.0 to 2.6.0 ([5a284b4](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/5a284b4))
- **deps-dev:** Bump eslint from 9.29.0 to 9.30.0 ([0a5e885](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/0a5e885))
- Bumped packages and apply formatting ([c16c843](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/c16c843))
- Added approved build ([c75bd7d](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/c75bd7d))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.0.1

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v1.0.0...v1.0.1)

### 🩹 Fixes

- Ignore reprocessed response content headers ([861fdfd](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/861fdfd))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v1.0.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.6.7...v1.0.0)

### 🚀 Enhancements

- **types:** ⚠️  Added explicit types for fetch client ([6054510](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/6054510))
- **hooks:** ⚠️  Migrated interceptors to hooks ([3d23818](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/3d23818))
- Added nuxt server proxy endpoint ([4a32314](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/4a32314))

### 🩹 Fixes

- **types:** ⚠️  Drop old app types augmentation ([4b54597](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/4b54597))

### 🏡 Chore

- **deps-dev:** Bump nuxt from 3.17.3 to 3.17.4 ([ce65d87](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/ce65d87))

#### ⚠️ Breaking Changes

- **types:** ⚠️  Added explicit types for fetch client ([6054510](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/6054510))
- **hooks:** ⚠️  Migrated interceptors to hooks ([3d23818](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/3d23818))
- **types:** ⚠️  Drop old app types augmentation ([4b54597](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/4b54597))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v0.6.7

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.6.6...v0.6.7)

### 🩹 Fixes

- Use proper typing for lazy fetch ([9c124dc](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/9c124dc))
- Use github action permissions ([1ced700](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/1ced700))

### 🏡 Chore

- **deps-dev:** Bump @types/node from 22.14.0 to 22.15.3 ([5de3e8f](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/5de3e8f))
- **deps-dev:** Bump @nuxt/kit from 3.16.2 to 3.17.1 ([6bf9aa1](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/6bf9aa1))
- **deps-dev:** Bump nuxt from 3.16.2 to 3.17.1 ([1caa2ce](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/1caa2ce))
- **deps-dev:** Bump @nuxt/schema from 3.16.2 to 3.17.1 ([95e2233](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/95e2233))
- Upgraded dependencies ([427ced5](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/427ced5))
- Upgraded nuxt module builder ([511d6fc](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/511d6fc))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v0.6.6

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.6.5...v0.6.6)

### 🩹 Fixes

- Removed redundant logging ([29fb5ba](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/29fb5ba))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v0.6.5

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.6.4...v0.6.5)

### 🩹 Fixes

- Avoid mutable list of interceptors ([333f7c8](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/333f7c8))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v0.6.4

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.6.3...v0.6.4)

### 🚀 Enhancements

- **hook:** Added onRequestError event `sanctum:error:request` hook ([b5095e5](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/b5095e5))

### 🏡 Chore

- Restructured project ([161dc4e](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/161dc4e))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v0.6.3

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.6.2...v0.6.3)

### 🚀 Enhancements

- **client:** Allow overriding of Accept header per request ([871fcae](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/871fcae))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v0.6.2

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.6.1...v0.6.2)

### 🚀 Enhancements

- Return login response ([d341431](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/d341431))

### 🏡 Chore

- **deps-dev:** Bump @nuxt/devtools from 2.3.1 to 2.3.2 ([5d8442f](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/5d8442f))
- **deps-dev:** Bump vitest from 3.0.9 to 3.1.1 ([71f7049](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/71f7049))
- **deps-dev:** Bump @types/node from 22.13.13 to 22.13.16 ([4273f0f](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/4273f0f))

### ❤️ Contributors

- SwiTool <switooldev@gmail.com>

## v0.6.1

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.6.0...v0.6.1)

### 🚀 Enhancements

- **logs:** Added more details into logs for troubleshooting ([b7331c9](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/b7331c9))
- **tests:** Added test fixture project to simulate remote API ([27a7976](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/27a7976))

### 🩹 Fixes

- **init:** Use raw fetch to handle errors on identity init ([c1321bf](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/c1321bf))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v0.6.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.5.8...v0.6.0)

### 🚀 Enhancements

- **hooks:** Added sanctum:error hook ([413989f](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/413989f))
- **hooks:** Added sanctum:redirect hook ([c7bf355](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/c7bf355))
- **hooks:** Added sanctum:init and sanctum:refresh hooks ([fa5b592](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/fa5b592))
- **hooks:** Added sanctum:login hook ([ad67393](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/ad67393))
- **hooks:** Added sanctum:logout hook ([dd496cf](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/dd496cf))
- **fetch:** ⚠️  Support AsyncDataOptions in sanctum fetch composables ([9f23351](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/9f23351))

### 🏡 Chore

- Upgraded nuxt packages ([0df572b](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/0df572b))
- Upgraded changelogen package ([03c8b31](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/03c8b31))
- Added troubleshooting guide link ([2bd41a1](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/2bd41a1))
- Upgraded nuxt dependencies ([5a34273](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/5a34273))

#### ⚠️ Breaking Changes

- **fetch:** ⚠️  Support AsyncDataOptions in sanctum fetch composables ([9f23351](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/9f23351))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](https://github.com/manchenkoff))

## v0.5.8

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.5.7...v0.5.8)

### 🩹 Fixes

- Use unique key for sanctum fetch across csr/ssr ([0d43ea6](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/0d43ea6))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.5.7

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.5.6...v0.5.7)

### 🩹 Fixes

- Migrated from useFetch to useAsyncData ([79cb27d](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/79cb27d))

### 🏡 Chore

- Dependencies upgrade ([2bbe90c](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/2bbe90c))
- **dev-deps:** Upgraded dev dependencies ([6a629df](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/6a629df))
- **dev-deps:** Upgraded nuxt devtools ([bc3b601](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/bc3b601))
- **security:** Upgraded esbuild to avoid security issues ([82ad135](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/82ad135))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.5.6

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.5.5...v0.5.6)

### 🚀 Enhancements

- Added new composables to make requests ([a6bfc2f](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/a6bfc2f))

### 🩹 Fixes

- Added type hints for fetch composables ([bbb9e04](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/bbb9e04))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.5.5

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.5.4...v0.5.5)

### 🩹 Fixes

- Use npm keys in actions ([9bc984f](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/9bc984f))
- Deduplicate `set-cookie` headers on SSR response ([9d957e2](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/9d957e2))
- Downgraded typescript to fix module-builder ([f28daf8](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/f28daf8))

### 🏡 Chore

- **deps-dev:** Bump @nuxt/devtools from 1.6.4 to 1.7.0 ([b58ebc4](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/b58ebc4))
- **deps-dev:** Bump @nuxt/eslint-config from 0.7.3 to 0.7.4 ([0f79c42](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/0f79c42))
- **deps-dev:** Bump @typescript-eslint/eslint-plugin ([0cae715](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/0cae715))
- **deps-dev:** Bump @nuxt/schema from 3.14.1592 to 3.15.0 ([77c79f6](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/77c79f6))
- **deps-dev:** Bump @nuxt/test-utils from 3.15.1 to 3.15.4 ([2cc446b](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/2cc446b))
- **deps-dev:** Bump vitest in the npm_and_yarn group ([b64a354](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/b64a354))
- **deps-dev:** Bump @nuxt/schema from 3.15.2 to 3.15.4 ([c2dd453](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/c2dd453))
- **deps-dev:** Bump @nuxt/eslint-config from 0.7.4 to 1.0.0 ([a435516](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/a435516))
- Upgraded nuxt packages ([e0c5bb9](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/e0c5bb9))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.5.4

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.5.3...v0.5.4)

### 🩹 Fixes

- Use relative paths for injected types ([63696ff](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/63696ff))

### ❤️ Contributors

- Denis Mamaev ([@ExileofAranei](http://github.com/ExileofAranei))

## v0.5.3

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.5.2...v0.5.3)

### 🩹 Fixes

- Expose plugin name to be used in dependsOn ([c2d930b](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/c2d930b))

### 🏡 Chore

- **deps-dev:** Bump @nuxt/schema from 3.14.159 to 3.14.1592 ([83be062](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/83be062))
- **deps-dev:** Bump nuxt from 3.14.159 to 3.14.1592 ([0469f64](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/0469f64))
- **deps-dev:** Bump @typescript-eslint/eslint-plugin ([f619be8](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/f619be8))
- **deps-dev:** Bump eslint from 9.15.0 to 9.16.0 ([464c8ed](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/464c8ed))
- **deps-dev:** Bump @nuxt/eslint-config from 0.7.0 to 0.7.2 ([38c1c46](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/38c1c46))
- **deps-dev:** Bump @nuxt/devtools from 1.6.1 to 1.6.3 ([31a8027](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/31a8027))
- **deps-dev:** Bump @typescript-eslint/eslint-plugin ([1d47a17](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/1d47a17))
- **deps-dev:** Bump vitest from 2.1.5 to 2.1.8 ([63fa544](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/63fa544))
- **deps-dev:** Bump @nuxt/test-utils from 3.14.4 to 3.15.1 ([7c21b35](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/7c21b35))
- **deps-dev:** Bump @types/node from 22.10.1 to 22.10.2 ([b1d429b](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/b1d429b))
- **deps-dev:** Bump @typescript-eslint/eslint-plugin ([3067b61](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/3067b61))
- **deps-dev:** Bump eslint from 9.16.0 to 9.17.0 ([ce17914](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/ce17914))
- **deps-dev:** Bump @nuxt/eslint-config from 0.7.2 to 0.7.3 ([2ff5e99](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/2ff5e99))
- Upgraded playground to nuxt v4 structure ([056b488](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/056b488))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.5.2

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.5.1...v0.5.2)

### 🩹 Fixes

- Support insecure cookies for auth token ([5e59064](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/5e59064))

### 🏡 Chore

- **deps-dev:** Bump @types/node from 22.7.7 to 22.8.1 ([979c480](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/979c480))
- **deps-dev:** Bump vue-tsc from 2.1.6 to 2.1.8 ([b3a6b5a](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/b3a6b5a))
- **deps-dev:** Bump vue-tsc from 2.1.8 to 2.1.10 ([73259c8](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/73259c8))
- **deps-dev:** Bump vitest from 2.1.3 to 2.1.4 ([ce299ac](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/ce299ac))
- **deps-dev:** Bump eslint from 9.13.0 to 9.14.0 ([2840859](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/2840859))
- **deps-dev:** Bump @nuxt/eslint-config from 0.6.0 to 0.6.1 ([5f4e34c](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/5f4e34c))
- **deps-dev:** Bump @types/node from 22.8.7 to 22.9.0 ([cbe9b6f](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/cbe9b6f))
- **deps-dev:** Bump nuxt from 3.13.2 to 3.14.159 ([79ccffc](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/79ccffc))
- **deps-dev:** Bump @nuxt/schema from 3.13.2 to 3.14.159 ([4dbd21a](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/4dbd21a))
- **deps-dev:** Bump vitest from 2.1.4 to 2.1.5 ([1bd218b](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/1bd218b))
- **deps-dev:** Bump @nuxt/eslint-config from 0.6.1 to 0.7.0 ([1303a9a](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/1303a9a))
- **deps-dev:** Bump eslint from 9.14.0 to 9.15.0 ([b71d6e8](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/b71d6e8))
- Install typescript-eslint with a fix ([0e6b0e5](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/0e6b0e5))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.5.1

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.5.0...v0.5.1)

### 🚀 Enhancements

- Add option to prepend the global middleware ([94c3346](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/94c3346))

### 🏡 Chore

- **deps-dev:** Bump eslint from 9.11.1 to 9.12.0 ([b593bd7](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/b593bd7))
- **deps-dev:** Bump @nuxt/test-utils from 3.14.2 to 3.14.3 ([e775417](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/e775417))
- **deps-dev:** Bump typescript from 5.5.4 to 5.6.3 ([0963a0b](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/0963a0b))
- **deps-dev:** Bump @nuxt/eslint-config from 0.5.7 to 0.6.0 ([c5bc900](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/c5bc900))
- Updated bug report issue template ([f8534f1](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/f8534f1))
- **deps-dev:** Bump @nuxt/test-utils from 3.14.3 to 3.14.4 ([e89441f](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/e89441f))
- **deps-dev:** Bump vitest from 2.1.2 to 2.1.3 ([e563484](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/e563484))
- **deps-dev:** Bump eslint from 9.12.0 to 9.13.0 ([412f36f](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/412f36f))

### ❤️ Contributors

- Jonian Guveli <jonian@hardpixel.eu>
- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.5.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.18...v0.5.0)

### 🚀 Enhancements

- ⚠️  Use ofetch as actual dependency ([07f0213](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/07f0213))

### 🩹 Fixes

- Expect object instead of headers to log ([aeeddb8](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/aeeddb8))

#### ⚠️ Breaking Changes

- ⚠️  Use ofetch as actual dependency ([07f0213](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/07f0213))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.18

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.17...v0.4.18)

### 🚀 Enhancements

- Improve headers logging readability ([8160e8c](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/8160e8c))

### 🩹 Fixes

- Use normalized Headers object for interceptors ([22602b6](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/22602b6))

### 🏡 Chore

- Use specific ofetch version for development ([6edf22d](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/6edf22d))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.17

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.16...v0.4.17)

### 🚀 Enhancements

- Added headers validation and more control on config values ([c08c778](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/c08c778))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.16

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.15...v0.4.16)

### 🩹 Fixes

- Prevent concurrent update of request headers ([c5af530](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/c5af530))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.15

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.14...v0.4.15)

### 🚀 Enhancements

- Add request and response headers logging ([fed1d16](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/fed1d16))

### 🩹 Fixes

- Prevent object merging with HeadersList ([393ddca](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/393ddca))

### 🏡 Chore

- **deps-dev:** Bump @nuxt/devtools from 1.5.0 to 1.5.1 ([c564ab3](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/c564ab3))
- **deps-dev:** Bump @types/node from 22.5.5 to 22.7.4 ([9a2f385](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/9a2f385))
- **deps-dev:** Bump eslint from 9.11.0 to 9.11.1 ([4b4ab3f](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/4b4ab3f))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.14

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.13...v0.4.14)

### 🩹 Fixes

- Use nuxt app context for default token storage ([1f7fdb2](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/1f7fdb2))

### 🏡 Chore

- Updated issue templates ([8647cdc](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/8647cdc))
- Updated bug report issue template ([fca3627](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/fca3627))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.13

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.12...v0.4.13)

### 🩹 Fixes

- Keep same session on SSR requests ([fc96f34](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/fc96f34))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.12

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.11...v0.4.12)

### 🚀 Enhancements

- Control plugin load order ([fa1e46d](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/fa1e46d))
- Control over initial user request ([5f3d8d4](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/5f3d8d4))

### 🏡 Chore

- **deps-dev:** Bump nuxt from 3.13.0 to 3.13.1 ([33e6323](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/33e6323))
- **deps-dev:** Bump @nuxt/eslint-config from 0.5.5 to 0.5.6 ([f88ecb9](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/f88ecb9))
- **deps-dev:** Bump vue-tsc from 2.1.4 to 2.1.6 ([11661f9](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/11661f9))
- **deps-dev:** Bump eslint from 9.9.1 to 9.10.0 ([95cd069](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/95cd069))
- **deps-dev:** Bump @nuxt/module-builder from 0.8.3 to 0.8.4 ([51fd807](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/51fd807))
- **deps-dev:** Bump @types/node from 22.5.2 to 22.5.5 ([abe3846](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/abe3846))
- **deps-dev:** Bump vitest from 2.0.5 to 2.1.1 ([bbcb244](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/bbcb244))
- Upgraded nuxt dependencies ([6b28a2a](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/6b28a2a))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.11

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.10...v0.4.11)

### 🏡 Chore

- **deps-dev:** Bump vue-tsc from 2.1.2 to 2.1.4 ([35efc7b](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/35efc7b))
- **deps-dev:** Bump @types/node from 22.5.1 to 22.5.2 ([7a7e912](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/7a7e912))
- **deps-dev:** Bump @nuxt/eslint-config from 0.5.4 to 0.5.5 ([84e836d](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/84e836d))

### 🤖 CI

- Added prerelease pipeline ([deff64a](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/deff64a))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.10

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.9...v0.4.10)

### 🩹 Fixes

- Improved nullable schema fields ([879fdee](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/879fdee))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.9

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.8...v0.4.9)

### 🚀 Enhancements

- Simplified module config ([b3bad10](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/b3bad10))

### 🩹 Fixes

- Added augmented types for PageMeta ([e784f88](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/e784f88))

### 🏡 Chore

- Migrated from yarn to pnpm ([bad9820](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/bad9820))
- Simplified pull request template ([8f8955b](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/8f8955b))
- Applied eslint formatter ([1b2670d](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/1b2670d))

### 🤖 CI

- Upgraded pipelines to work with pnpm ([1a041da](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/1a041da))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.8

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.7...v0.4.8)

### 🩹 Fixes

- Update to latest `@nuxt/module-builder` ([fdeae82](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/fdeae82))

### ❤️ Contributors

- Daniel Roe ([@danielroe](http://github.com/danielroe))

## v0.4.7

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.6...v0.4.7)

### 🩹 Fixes

- Use new augmented types from nuxt 3.13 ([197f1c3](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/197f1c3))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.6

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.5...v0.4.6)

### 🩹 Fixes

- Do not trim single slash in the url ([81c87d0](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/81c87d0))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.5

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.4...v0.4.5)

### 🩹 Fixes

- Trim trailing slash on redirects ([d24014d](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/d24014d))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.4

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.3...v0.4.4)

### 🩹 Fixes

- Fallback to #app augmented type for page meta ([cbf8a6c](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/cbf8a6c))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.3

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.2...v0.4.3)

### 🩹 Fixes

- Use resolved path for augmented types when using pnpm ([050c006](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/050c006))

### 🏡 Chore

- Upgraded nuxt version ([0cd2d51](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/0cd2d51))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.2

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.1...v0.4.2)

### 🚀 Enhancements

- Configure redirect if unauthenticated ([9574818](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/9574818))

### 🩹 Fixes

- Use updated csrf token on first login ([14f5c63](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/14f5c63))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.1

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.4.0...v0.4.1)

### 🩹 Fixes

- Experimental support for cloudflare workers ([9146cba](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/9146cba))

### 🏡 Chore

- Updated github templates ([932fd0f](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/932fd0f))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.4.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.14...v0.4.0)

### 🚀 Enhancements

- ⚠️  Dropped support for excludeFromSanctum page meta ([5d09e71](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/5d09e71))
- Added token storage support ([2ebcfbf](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/2ebcfbf))

### 🏡 Chore

- Updated playgorund config to breeze-api ([5644023](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/5644023))
- Indicate compatibility with new v4 major ([54869f7](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/54869f7))

#### ⚠️ Breaking Changes

- ⚠️  Dropped support for excludeFromSanctum page meta ([5d09e71](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/5d09e71))

### ❤️ Contributors

- Daniel Roe ([@danielroe](http://github.com/danielroe))
- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.14

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.13...v0.3.14)

### 🩹 Fixes

- Changed path with typo ([1c9c963](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/1c9c963))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.13

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.12...v0.3.13)

### 🩹 Fixes

- Hardcode absolute path to node_modules for page meta ([eb0d555](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/eb0d555))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.12

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.11...v0.3.12)

### 🩹 Fixes

- Adjusted path for page meta type ([c0ddc35](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/c0ddc35))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.11

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.10...v0.3.11)

### 🩹 Fixes

- Expose page meta augmented type ([b49fdfb](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/b49fdfb))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.10

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.9...v0.3.10)

### 🩹 Fixes

- Removed workspace from dependencies ([a648ae9](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/a648ae9))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.9

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.8...v0.3.9)

### 🩹 Fixes

- Expose type via templates ([d1ed3a4](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/d1ed3a4))
- Export public runtime config as part of module ([43fd15c](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/43fd15c))

### 🏡 Chore

- Added typing for interceptors ([8446f6a](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/8446f6a))
- Added transpile build option ([40fe0b2](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/40fe0b2))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.8

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.7...v0.3.8)

### 🩹 Fixes

- Updated exporting nuxt schemas ([fa608f6](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/fa608f6))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.7

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.6...v0.3.7)

### 🩹 Fixes

- Use common request header ([2536f21](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/2536f21))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.6

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.5...v0.3.6)

### 🩹 Fixes

- Export module types ([b1a513b](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/b1a513b))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.5

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.4...v0.3.5)

### 🚀 Enhancements

- Added support for custom interceptors ([2795998](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/2795998))

### 🩹 Fixes

- Disabled typecheck in the playground ([cd77036](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/cd77036))

### 🏡 Chore

- Upgraded module build dependencies ([16cdde6](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/16cdde6))
- Extracted default module options ([e0f2c7a](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/e0f2c7a))
- Applied formatting to system files ([ae7918f](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/ae7918f))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.4

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.3...v0.3.4)

### 🩹 Fixes

- Dropped extenal cookie parser to use h3 ([1410179](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/1410179))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.3

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.2...v0.3.3)

### 🩹 Fixes

- Fixed cookie parses dependency ([bd6ef34](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/bd6ef34))

### 🏡 Chore

- Upgraded yarn to 4.2.2 ([007a7e4](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/007a7e4))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.2

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.1...v0.3.2)

### 🩹 Fixes

- Added github token for automatic release creation ([84fac56](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/84fac56))
- Request csrf only when not set ([569dbdc](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/569dbdc))
- Added csrf cookie for secure ssr calls ([8b45e06](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/8b45e06))

### 🏡 Chore

- Added debug log for user initial request ([409b3ae](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/409b3ae))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.1

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.3.0...v0.3.1)

### 🩹 Fixes

- Added npm credentials config ([51d76ef](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/51d76ef))
- Added id-token permission for pipeline ([72b08ea](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/72b08ea))
- Keep config type exported in composable ([3862bfb](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/3862bfb))

### 🏡 Chore

- Upgraded setup-node to v4 ([3f6226d](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/3f6226d))
- Removed temp pipeline for publishing ([3bd6027](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/3bd6027))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.3.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.2.3...v0.3.0)

### 🚀 Enhancements

- Added publish workflow ([3c8baef](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/3c8baef))
- ⚠️  Added guest mode for global middleware ([50f2a10](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/50f2a10))

### 🩹 Fixes

- Include history and write permissions in release pipeline ([220e16b](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/220e16b))

### 🏡 Chore

- **release:** V0.2.3 ([0397aa5](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/0397aa5))
- Dropped support of old versions ([8366255](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/8366255))

#### ⚠️ Breaking Changes

- ⚠️  Added guest mode for global middleware ([50f2a10](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/50f2a10))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.2.3

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.2.2...v0.2.3)

### 🩹 Fixes

- Resolved constant visibility issue ([5cbd7a3](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/5cbd7a3))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.2.2

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.2.0...v0.2.2)

### 🚀 Enhancements

- Added logger support ([9a62a8f](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/9a62a8f))
- Added logs into plugin ([79e2558](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/79e2558))

### 🩹 Fixes

- Remove git push with tags ([03b28d4](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/03b28d4))
- Prevent infinite redirect for guests ([20e7cc9](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/20e7cc9))
- Removed redundant empty line ([6426309](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/6426309))
- Reset user only when it expires ([d314b86](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/d314b86))
- Request identity once on plugin init ([c88fbdf](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/c88fbdf))
- Push main branch after bumping release version ([cc76b0e](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/cc76b0e))

### 📖 Documentation

- Use new `nuxi module add` command in installation ([d74c007](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/d74c007))
- Update second step ([93e365d](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/93e365d))

### 🏡 Chore

- **release:** V0.2.1 ([cf80175](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/cf80175))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))
- Daniel Roe ([@danielroe](http://github.com/danielroe))

## v0.2.1

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.2.0...v0.2.1)

### 🩹 Fixes

- Remove git push with tags ([03b28d4](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/03b28d4))
- Prevent infinite redirect for guests ([20e7cc9](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/20e7cc9))

### 📖 Documentation

- Use new `nuxi module add` command in installation ([d74c007](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/d74c007))
- Update second step ([93e365d](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/93e365d))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))
- Daniel Roe ([@danielroe](http://github.com/danielroe))

## v0.2.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.1.2...v0.2.0)

### 🚀 Enhancements

- Add Origin header to the request ([6387379](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/6387379))
- Added separate error page ([79ce7b2](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/79ce7b2))
- Implemented global middleware ([6322fd3](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/6322fd3))

### 🩹 Fixes

- Opt in to `import.meta.*` properties ([99e98c9](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/99e98c9))
- Prevent redirects to the same page ([01daa22](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/01daa22))
- Prevent redirect on 401 response from login page ([380d4a6](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/380d4a6))
- Removed mistaken command from contributing rules ([f4fbf82](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/f4fbf82))
- Adjusted tsc directories to check ([de23cbb](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/de23cbb))

### 📖 Documentation

- Added separate gitbook as module docs ([f7c4edc](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/f7c4edc))
- Added toc to readme ([497386b](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/497386b))

### 🏡 Chore

- **release:** V0.1.2 ([f23e51a](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/f23e51a))
- Code style improvements ([32b0a64](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/32b0a64))
- Simplified middleware checks ([1c186b9](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/1c186b9))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))
- Daniel Roe ([@danielroe](http://github.com/danielroe))

## v0.1.2

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.1.1...v0.1.2)

### 🩹 Fixes

- Added required config to fixture env ([09b621d](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/09b621d))
- Updated nuxt dependencies and fixed test behavior ([e06cb36](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/e06cb36))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.1.1

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.1.0...v0.1.1)

### 🩹 Fixes

- Dumped compatibility version to 3.9 ([1268ffc](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/1268ffc))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.1.0

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.0.17...v0.1.0)

### 🚀 Enhancements

- Upgraded nuxt dependencies ([2c82ae6](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/2c82ae6))
- Handle cookies in read-only mode ([632abab](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/632abab))

### 🩹 Fixes

- Remove redundant config from playground ([8288cc0](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/8288cc0))
- Revert nuxt 3.10 to 3.9 because of bugs ([1eb3f0a](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/1eb3f0a))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.0.17

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.0.16...v0.0.17)

## v0.0.16

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.0.15...v0.0.16)

### 🚀 Enhancements

- **origin:** Set to optional ([dfe0805](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/dfe0805))
- **origin:** Fix indent ([a50d2c7](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/a50d2c7))

### ❤️ Contributors

- Ugo Mignon <ugomignon@gmail.com>

## v0.0.14

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.0.13...v0.0.14)

### 🏡 Chore

- Test bundler module resolution ([4dc2cde](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/4dc2cde))

### ❤️ Contributors

- Daniel Roe <daniel@roe.dev>

## v0.0.13

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/list...v0.0.13)

### 🏡 Chore

- **release:** V0.0.12 ([8230041](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/8230041))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.0.12

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/list...v0.0.12)

## v0.0.11

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.0.10...v0.0.11)

## v0.0.10

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.0.9...v0.0.10)

## v0.0.9

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.0.8...v0.0.9)

## v0.0.8

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.0.7...v0.0.8)

## v0.0.7

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.0.6...v0.0.7)

## v0.0.6

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.0.5...v0.0.6)

### 🏡 Chore

- **release:** V0.0.5 ([d52546e](https://github.com/manchenkoff/nuxt-auth-sanctum/commit/d52546e))

### ❤️ Contributors

- Manchenkoff ([@manchenkoff](http://github.com/manchenkoff))

## v0.0.5

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.0.4...v0.0.5)

## v0.0.4

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.0.3...v0.0.4)

## v0.0.3

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.0.2...v0.0.3)

## v0.0.2

[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v0.0.1...v0.0.2)

## v0.0.1

- Initial release
- Added first implementation of the module
- Added readme
- Published NPM package



================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

-   Demonstrating empathy and kindness toward other people
-   Being respectful of differing opinions, viewpoints, and experiences
-   Giving and gracefully accepting constructive feedback
-   Accepting responsibility and apologizing to those affected by our mistakes,
    and learning from the experience
-   Focusing on what is best not just for us as individuals, but for the
    overall community

Examples of unacceptable behavior include:

-   The use of sexualized language or imagery, and sexual attention or
    advances of any kind
-   Trolling, insulting or derogatory comments, and personal or political attacks
-   Public or private harassment
-   Publishing others' private information, such as a physical or email
    address, without their explicit permission
-   Other conduct which could reasonably be considered inappropriate in a
    professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
artem@manchenkoff.me.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.


================================================
FILE: CONTRIBUTING.md
================================================
# How to contribute

Please follow the guidelines below if you want to contribute to the project.

If you are working on a new feature, please create an issue on GitHub first. This will help us to understand what you are working on and to avoid duplication of work.

# Development environment

You can clone the repo by running the following command:

```bash
git clone git@github.com:manchenkoff/nuxt-auth-sanctum.git
```

Then you should create a new branch with the following name convention:

```bash
git checkout -b XXX-feature-name
```

Where `XXX` is the issue number on the GitHub.

## Install dependencies

To setup the development environment, you should install the dependencies first. You can do this by running the following command:

```bash
pnpm install
```

Then you can start dev server to see the playground app:

```bash
pnpm dev
```

Or if you want to build the project, you can run one of the following commands:

```bash
# Generate type stubs
pnpm dev:prepare

# Build the playground
pnpm dev:build
```

# Testing process

To test playground app you need to have a Laravel API running with Sanctum package installed.

if there are tests for the feature you are working on, you can run them by executing one of the following commands:

```bash
# Run Vitest
pnpm test

# Run Vitest in watch mode
pnpm test:watch
```

# Testing package locally

If you want to test the package before publishing it to `npm`, 
you can create an archive and install it as a dependency in your project.

To do this, run the following command:

```bash
pnpm rc
```

This will create a `.tgz` file in the `dist` directory. You can then reference it in your project:

```json
{
  "devDependencies": {
    "nuxt-auth-sanctum": "file:/dist/nuxt-auth-sanctum-0.0.0.tgz"
  }
}
```

Then you can install the package by running:

```bash
pnpm install
```

# Code Style and Standards

This project uses ESLint to enforce code style and standards. Please make sure to run the following commands before creating a pull request:

```bash
# Run ESLint
pnpm lint

# Run Nuxt type check
pnpm test:types

# Run Vitest
pnpm test
```

# Releasing

Once all the changes are merged into main branch, run the following command to release a new version:

```bash
pnpm release
```

# Code of Conduct

All contributors are expected to adhere to the [Code of Conduct](CODE_OF_CONDUCT.md). Please read it.

# Get in touch

If you have any questions or need help, feel free to reach out via artem@manchenkoff.me or by opening a new issue on Github.


================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2023 Artem Manchenkov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: README.md
================================================
# Nuxt Auth Sanctum

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
[![Nuxt][nuxt-src]][nuxt-href]

This module provides a simple way to use Laravel Sanctum with Nuxt by leveraging cookies-based authentication. SSR-ready!

- [Documentation](https://sanctum.manchenkoff.me)
- [Features](#features)
- [Quick Setup](#quick-setup)

## Features

This module includes a range of features designed to streamline authentication:

- `useSanctumAuth` composable for easy access to the current user and authentication methods
- `useSanctumFetch` and `useLazySanctumFetch` to load data from your API
- Automated `CSRF` token header and cookie management
- Automated `Bearer` token header management
- Both `CSR` and `SSR` modes support
- Pre-configured middleware for pages that require authentication
- Cast current user information to any class you want
- Custom `request` and `response` interceptors
- Subscribe to `sanctum:*` hooks to react as you want
- Compatible with default Nuxt `ofetch` client
- TypeScript support
- ... and more, check the docs!

**Note:** Before using this module, please make sure that you have already configured Laravel Sanctum on your backend. You can find more information about Laravel Sanctum [here](https://laravel.com/docs/10.x/sanctum#spa-authentication).

Complete documentation - [Nuxt Auth Sanctum docs](https://sanctum.manchenkoff.me)

## Quick Setup

1. Add `nuxt-auth-sanctum` dependency to your project

```bash
npx nuxi@latest module add nuxt-auth-sanctum
```

2. Add any required configuration in your `nuxt.config.ts` file

```js
export default defineNuxtConfig({
  modules: ["nuxt-auth-sanctum"],

  sanctum: {
    baseUrl: "http://localhost:80", // Laravel API
  },
});
```

That's it! You can now use Nuxt Auth Sanctum in your Nuxt app ✨

For more details, check the documentation [here](https://sanctum.manchenkoff.me)

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/nuxt-auth-sanctum/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-version-href]: https://npmjs.com/package/nuxt-auth-sanctum
[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-auth-sanctum.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-downloads-href]: https://npm.chart.dev/nuxt-auth-sanctum
[license-src]: https://img.shields.io/npm/l/nuxt-auth-sanctum.svg?style=flat&colorA=18181B&colorB=28CF8D
[license-href]: https://npmjs.com/package/nuxt-auth-sanctum
[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
[nuxt-href]: https://nuxt.com

### Powered by

[![JetBrains logo.](https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg)](https://jb.gg/OpenSource)


================================================
FILE: SECURITY.md
================================================
# Security Policy

## Supported Versions

| Version  | Supported          |
| -------- | ------------------ |
| >= 0.3.0 | :white_check_mark: |
| <= 0.2.0 | :x:                |

## Reporting a Vulnerability

If you find a vulnerability, please get in touch with me via artem@manchenkoff.me or by opening a new issue in the repository.

Usually, I respond in a few days but sometimes it might take a bit more.


================================================
FILE: TROUBLESHOOTING.md
================================================
# Troubleshooting Guide

If you experience any issues while using this module, please check this link - [Troubleshooting](https://sanctum.manchenkoff.me/advanced/troubleshooting).


================================================
FILE: docs/.env.example
================================================
# Public URL, used for OG Image when running nuxt generate
NUXT_PUBLIC_SITE_URL=https://sanctum.manchenkoff.me



================================================
FILE: docs/.gitignore
================================================
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist

# Node dependencies
node_modules

# Logs
logs
*.log

# Misc
.DS_Store
.fleet
.idea

# Local env files
.env
.env.*
!.env.example

# VSC
.history


================================================
FILE: docs/.npmrc
================================================
shamefully-hoist=true


================================================
FILE: docs/README.md
================================================
# Nuxt - Laravel Sanctum Docs

This directory contains Nuxt Content project to deploy
module documentation to Github Pages.

## Setup

Make sure to install the dependencies:

```bash
pnpm install
```

## Development Server

Start the development server on `http://localhost:3000`:

```bash
pnpm dev
```

## Production

Build the application for production:

```bash
pnpm build
```

Or generate all pages for static hosting via:

```bash
pnpm generate
```

Locally preview production build:

```bash
pnpm preview
```

## Validation

To check code quality, run the following command:

```bash
pnpm validate
```

or separately:

```bash
pnpm lint
pnpm typecheck
```



================================================
FILE: docs/app/app.config.ts
================================================
const siteName = 'Nuxt - Laravel Sanctum'

export default defineAppConfig({
  ui: {
    colors: {
      primary: 'red',
      neutral: 'zinc'
    },
    footer: {
      slots: {
        root: 'border-t border-default',
        left: 'text-sm text-muted'
      }
    }
  },
  seo: {
    siteName: siteName
  },
  header: {
    title: siteName,
    to: '/',
    logo: {
      alt: 'Laravel Sanctum',
      light: 'logo.svg',
      dark: 'logo.svg'
    },
    search: true,
    colorMode: true,
    links: [
      {
        'icon': 'i-simple-icons-github',
        'to': 'https://github.com/manchenkoff/nuxt-auth-sanctum',
        'target': '_blank',
        'aria-label': 'GitHub'
      },
      {
        'icon': 'i-simple-icons-nuxt',
        'to': 'https://nuxt.com/modules/nuxt-auth-sanctum',
        'target': '_blank',
        'aria-label': 'Nuxt Module'
      }
    ]
  },
  footer: {
    credits: `Artem Manchenkov © ${new Date().getFullYear()}`,
    colorMode: false,
    links: [
      {
        'icon': 'i-simple-icons-github',
        'to': 'https://github.com/manchenkoff',
        'target': '_blank',
        'aria-label': 'manchenkoff on GitHub'
      },
      {
        'icon': 'i-simple-icons-twitter',
        'to': 'https://twitter.com/amanchenkov',
        'target': '_blank',
        'aria-label': 'manchenkoff on X'
      },
      {
        'icon': 'i-simple-icons-facebook',
        'to': 'https://fb.com/manchenkoff',
        'target': '_blank',
        'aria-label': 'manchenkoff on Facebook'
      },
      {
        'icon': 'i-simple-icons-linkedin',
        'to': 'https://linkedin.com/in/manchenkoff',
        'target': '_blank',
        'aria-label': 'manchenkoff on LinkedIn'
      },
      {
        'icon': 'i-simple-icons-instagram',
        'to': 'https://instagram.com/manchenkof',
        'target': '_blank',
        'aria-label': 'manchenkoff on Instagram'
      },
      {
        'icon': 'i-simple-icons-threads',
        'to': 'https://threads.net/@manchenkof',
        'target': '_blank',
        'aria-label': 'manchenkoff on Threads'
      },
      {
        'icon': 'i-simple-icons-youtube',
        'to': 'https://youtube.com/@manchenkoff',
        'target': '_blank',
        'aria-label': 'manchenkoff on YouTube'
      },
      {
        'icon': 'i-simple-icons-medium',
        'to': 'https://manchenkoff.medium.com/',
        'target': '_blank',
        'aria-label': 'manchenkoff on Medium'
      },
      {
        'icon': 'i-simple-icons-telegram',
        'to': 'https://t.me/manchenkoff',
        'target': '_blank',
        'aria-label': 'manchenkoff on Telegram'
      },
      {
        'icon': 'i-simple-icons-bluesky',
        'to': 'https://bsky.app/profile/manchenkoff.bsky.social',
        'target': '_blank',
        'aria-label': 'manchenkoff on Bluesky'
      }
    ]
  },
  toc: {
    title: 'Table of Contents',
    bottom: {
      title: 'Ready to contribute?',
      edit: 'https://github.com/manchenkoff/nuxt-auth-sanctum/edit/main/docs/content',
      links: [
        {
          icon: 'i-lucide-star',
          label: 'Star on GitHub',
          to: 'https://github.com/manchenkoff/nuxt-auth-sanctum',
          target: '_blank'
        },
        {
          icon: 'i-lucide-git-pull-request-create',
          label: 'Suggest a feature',
          to: 'https://github.com/manchenkoff/nuxt-auth-sanctum/issues/new?template=feature_request.md',
          target: '_blank'
        },
        {
          icon: 'i-simple-icons-github',
          label: 'Support project',
          to: 'https://github.com/sponsors/manchenkoff?o=esb',
          target: '_blank'
        },
        {
          icon: 'i-simple-icons-buymeacoffee',
          label: 'Buy me a coffee',
          to: 'https://buymeacoffee.com/manchenkoff',
          target: '_blank'
        }
      ]
    }
  }
})


================================================
FILE: docs/app/app.vue
================================================
<script setup lang="ts">
const { seo } = useAppConfig()

const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('docs'))
const { data: files } = useLazyAsyncData(
  'search', () => queryCollectionSearchSections('docs'),
  { server: false }
)

useHead({
  meta: [
    { name: 'viewport', content: 'width=device-width, initial-scale=1' }
  ],
  link: [
    { rel: 'icon', href: '/logo.svg' }
  ],
  htmlAttrs: {
    lang: 'en'
  }
})

useSeoMeta({
  titleTemplate: `%s - ${seo?.siteName}`,
  ogSiteName: seo?.siteName,
  twitterCard: 'summary_large_image'
})

provide('navigation', navigation)
</script>

<template>
  <UApp>
    <NuxtLoadingIndicator />

    <AppHeader />

    <UMain>
      <NuxtLayout>
        <NuxtPage />
      </NuxtLayout>
    </UMain>

    <AppFooter />

    <ClientOnly>
      <LazyUContentSearch
        :files="files"
        :navigation="navigation"
      />
    </ClientOnly>
  </UApp>
</template>


================================================
FILE: docs/app/assets/css/main.css
================================================
@import "tailwindcss";
@import "@nuxt/ui";

@source "../../../content/**/*";

@theme static {
  --container-8xl: 90rem;
  --font-sans: 'Public Sans', sans-serif;
}

:root {
  --ui-container: var(--container-8xl);
}


================================================
FILE: docs/app/components/AppFooter.vue
================================================
<script setup lang="ts">
const { footer } = useAppConfig()
</script>

<template>
  <UFooter>
    <template #left>
      {{ footer.credits }}
    </template>

    <template #right>
      <UColorModeButton v-if="footer?.colorMode" />

      <template v-if="footer?.links">
        <UButton
          v-for="(link, index) of footer?.links"
          :key="index"
          v-bind="{ color: 'neutral', variant: 'ghost', ...link }"
        />
      </template>
    </template>
  </UFooter>
</template>


================================================
FILE: docs/app/components/AppHeader.vue
================================================
<script setup lang="ts">
import type { ContentNavigationItem } from '@nuxt/content'

const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')

const { header } = useAppConfig()
</script>

<template>
  <UHeader
    :ui="{ center: 'flex-1' }"
    :to="header?.to || '/'"
  >
    <UContentSearchButton
      v-if="header?.search"
      :collapsed="false"
      class="w-full"
    />

    <template #title>
      <AppLogo />
    </template>

    <template #right>
      <UContentSearchButton
        v-if="header?.search"
        class="lg:hidden"
      />

      <UColorModeButton v-if="header?.colorMode" />

      <template v-if="header?.links">
        <UButton
          v-for="(link, index) of header.links"
          :key="index"
          v-bind="{ color: 'neutral', variant: 'ghost', ...link }"
        />
      </template>
    </template>

    <template #body>
      <UContentNavigation
        highlight
        :navigation="navigation"
      />
    </template>
  </UHeader>
</template>


================================================
FILE: docs/app/components/AppLogo.vue
================================================
<script lang="ts" setup>
const { header } = useAppConfig()
</script>

<template>
  <div class="flex gap-2 items-center">
    <UColorModeImage
      v-if="header?.logo?.dark || header?.logo?.light"
      :light="header?.logo?.light!"
      :dark="header?.logo?.dark!"
      :alt="header?.logo?.alt"
      class="h-8 w-auto shrink-0"
    />

    <span>{{ header.title }}</span>
  </div>
</template>

<style scoped></style>


================================================
FILE: docs/app/components/OgImage/OgImageDocs.takumi.vue
================================================
<script lang="ts" setup>
interface ComponentProps {
  title?: string
  description?: string
  headline?: string
}

const props = withDefaults(
  defineProps<ComponentProps>(),
  {
    title: 'title',
    description: 'description'
  }
)

const title = computed(() => (props.title || '').slice(0, 60))
const description = computed(() => (props.description || '').slice(0, 200))
</script>

<template>
  <div class="w-full h-full flex flex-col justify-center bg-[#020420]">
    <svg
      class="absolute right-0 top-0"
      width="629"
      height="593"
      viewBox="0 0 629 593"
      fill="none"
      xmlns="http://www.w3.org/2000/svg"
    >
      <g filter="url(#filter0_f_199_94966)">
        <path
          d="M628.5 -578L639.334 -94.4223L806.598 -548.281L659.827 -87.387L965.396 -462.344L676.925 -74.0787L1087.69 -329.501L688.776 -55.9396L1160.22 -164.149L694.095 -34.9354L1175.13 15.7948L692.306 -13.3422L1130.8 190.83L683.602 6.50012L1032.04 341.989L668.927 22.4412L889.557 452.891L649.872 32.7537L718.78 511.519L628.5 36.32L538.22 511.519L607.128 32.7537L367.443 452.891L588.073 22.4412L224.955 341.989L573.398 6.50012L126.198 190.83L564.694 -13.3422L81.8734 15.7948L562.905 -34.9354L96.7839 -164.149L568.224 -55.9396L169.314 -329.501L580.075 -74.0787L291.604 -462.344L597.173 -87.387L450.402 -548.281L617.666 -94.4223L628.5 -578Z"
          fill="#00DC82"
        />
      </g>
      <defs>
        <filter
          id="filter0_f_199_94966"
          x="0.873535"
          y="-659"
          width="1255.25"
          height="1251.52"
          filterUnits="userSpaceOnUse"
          color-interpolation-filters="sRGB"
        >
          <feFlood
            flood-opacity="0"
            result="BackgroundImageFix"
          />
          <feBlend
            mode="normal"
            in="SourceGraphic"
            in2="BackgroundImageFix"
            result="shape"
          />
          <feGaussianBlur
            stdDeviation="40.5"
            result="effect1_foregroundBlur_199_94966"
          />
        </filter>
      </defs>
    </svg>

    <div class="pl-[100px]">
      <p
        v-if="headline"
        class="uppercase text-[24px] text-[#00DC82] mb-4 font-semibold"
      >
        {{ headline }}
      </p>
      <h1
        v-if="title"
        class="m-0 text-[75px] font-semibold mb-4 text-white flex items-center"
      >
        <span>{{ title }}</span>
      </h1>
      <p
        v-if="description"
        class="text-[32px] text-[#E4E4E7] leading-tight w-[700px]"
      >
        {{ description }}
      </p>
    </div>
  </div>
</template>


================================================
FILE: docs/app/components/content/HeroBackground.vue
================================================
<script setup lang="ts">
const { isLoading } = useLoadingIndicator()

const appear = ref(false)
const appeared = ref(false)

onMounted(() => {
  setTimeout(() => {
    appear.value = true
    setTimeout(() => {
      appeared.value = true
    }, 1000)
  }, 0)
})
</script>

<template>
  <div
    class="absolute w-full -top-px transition-all text-primary shrink-0"
    :class="[
      isLoading ? 'animate-pulse' : (appear ? '' : 'opacity-0'),
      appeared ? 'duration-[400ms]': 'duration-1000'
    ]"
  >
    <svg
      viewBox="0 0 1440 181"
      fill="none"
      xmlns="http://www.w3.org/2000/svg"
      class="pointer-events-none"
    >
      <mask
        id="path-1-inside-1_414_5526"
        fill="white"
      >
        <path d="M0 0H1440V181H0V0Z" />
      </mask>
      <path
        d="M0 0H1440V181H0V0Z"
        fill="url(#paint0_linear_414_5526)"
        fill-opacity="0.22"
      />
      <path
        d="M0 2H1440V-2H0V2Z"
        fill="url(#paint1_linear_414_5526)"
        mask="url(#path-1-inside-1_414_5526)"
      />
      <defs>
        <linearGradient
          id="paint0_linear_414_5526"
          x1="720"
          y1="0"
          x2="720"
          y2="181"
          gradientUnits="userSpaceOnUse"
        >
          <stop stop-color="currentColor" />
          <stop
            offset="1"
            stop-color="currentColor"
            stop-opacity="0"
          />
        </linearGradient>
        <linearGradient
          id="paint1_linear_414_5526"
          x1="0"
          y1="90.5"
          x2="1440"
          y2="90.5"
          gradientUnits="userSpaceOnUse"
        >
          <stop
            stop-color="currentColor"
            stop-opacity="0"
          />
          <stop
            offset="0.395"
            stop-color="currentColor"
          />
          <stop
            offset="1"
            stop-color="currentColor"
            stop-opacity="0"
          />
        </linearGradient>
      </defs>
    </svg>
  </div>
</template>


================================================
FILE: docs/app/components/content/StarsBackground.vue
================================================
<script setup lang="ts">
interface ComponentProps {
  starCount?: number
  color?: string
  speed?: 'slow' | 'normal' | 'fast'
  size?: { min: number, max: number }
}

interface Star {
  x: number
  y: number
  size: number
}

const props = withDefaults(
  defineProps<ComponentProps>(),
  {
    starCount: 300,
    color: 'var(--ui-primary)',
    speed: 'normal',
    size: () => ({
      min: 1,
      max: 2
    })
  }
)

// Generate random star positions and sizes
const generateStars = (count: number): Star[] => {
  return Array.from({ length: count }, () => ({
    x: Math.floor(Math.random() * 2000),
    y: Math.floor(Math.random() * 2000),
    size: typeof props.size === 'number'
      ? props.size
      : Math.random() * (props.size.max - props.size.min) + props.size.min
  }))
}

// Define speed configurations once
const speedMap = {
  slow: { duration: 200, opacity: 0.5, ratio: 0.3 },
  normal: { duration: 150, opacity: 0.75, ratio: 0.3 },
  fast: { duration: 100, opacity: 1, ratio: 0.4 }
}

// Use a more efficient approach to generate and store stars
const stars = useState<{ slow: Star[], normal: Star[], fast: Star[] }>('stars', () => {
  return {
    slow: generateStars(Math.floor(props.starCount * speedMap.slow.ratio)),
    normal: generateStars(Math.floor(props.starCount * speedMap.normal.ratio)),
    fast: generateStars(Math.floor(props.starCount * speedMap.fast.ratio))
  }
})

// Compute star layers with different speeds and opacities
const starLayers = computed(() => [
  { stars: stars.value.fast, ...speedMap.fast },
  { stars: stars.value.normal, ...speedMap.normal },
  { stars: stars.value.slow, ...speedMap.slow }
])
</script>

<template>
  <div class="absolute pointer-events-none z-[-1] inset-y-0 inset-x-5 sm:inset-x-7 lg:inset-x-9 overflow-hidden">
    <svg
      class="absolute inset-0 pointer-events-none"
      viewBox="0 0 1017 181"
      fill="none"
      xmlns="http://www.w3.org/2000/svg"
    >
      <g opacity="0.5">
        <mask
          id="path-1-inside-1_846_160841"
          fill="white"
        >
          <path d="M0 0H1017V181H0V0Z" />
        </mask>
        <path
          d="M0 0H1017V181H0V0Z"
          fill="url(#paint0_radial_846_160841)"
          fill-opacity="0.22"
        />
      </g>
      <defs>
        <radialGradient
          id="paint0_radial_846_160841"
          cx="0"
          cy="0"
          r="1"
          gradientUnits="userSpaceOnUse"
          gradientTransform="translate(508.999 19.5) rotate(90.177) scale(161.501 509.002)"
        >
          <stop stop-color="var(--ui-primary)" />
          <stop
            offset="1"
            stop-color="var(--ui-primary)"
            stop-opacity="0"
          />
        </radialGradient>
        <linearGradient
          id="paint1_linear_846_160841"
          x1="10.9784"
          y1="91"
          x2="1017"
          y2="90.502"
          gradientUnits="userSpaceOnUse"
        >
          <stop
            stop-color="var(--ui-primary)"
            stop-opacity="0"
          />
          <stop
            offset="0.395"
            stop-color="var(--ui-primary)"
          />
          <stop
            offset="1"
            stop-color="var(--ui-primary)"
            stop-opacity="0"
          />
        </linearGradient>
      </defs>
    </svg>

    <div class="stars size-full absolute inset-x-0 top-0">
      <div
        v-for="(layer, index) in starLayers"
        :key="index"
        class="star-layer"
        :style="{
          '--star-duration': `${layer.duration}s`,
          '--star-opacity': layer.opacity,
          '--star-color': color
        }"
      >
        <div
          v-for="(star, starIndex) in layer.stars"
          :key="starIndex"
          class="star absolute rounded-full"
          :style="{
            left: `${star.x}px`,
            top: `${star.y}px`,
            width: `${star.size}px`,
            height: `${star.size}px`,
            backgroundColor: 'var(--star-color)',
            opacity: 'var(--star-opacity)'
          }"
        />
      </div>
    </div>
  </div>
</template>

<style scoped>
.stars {
  left: 50%;
  transform: translate(-50%);
  -webkit-mask-image: linear-gradient(180deg,
      rgba(217, 217, 217, 0) 0%,
      rgba(217, 217, 217, 0.8) 25%,
      #d9d9d9 50%,
      rgba(217, 217, 217, 0.8) 75%,
      rgba(217, 217, 217, 0) 100%);
  mask-image: linear-gradient(180deg,
      rgba(217, 217, 217, 0) 0%,
      rgba(217, 217, 217, 0.8) 25%,
      #d9d9d9 50%,
      rgba(217, 217, 217, 0.8) 75%,
      rgba(217, 217, 217, 0) 100%);
  -webkit-mask-size: cover;
  mask-size: cover;
}

.star-layer {
  animation: risingStarsAnimation linear infinite;
  animation-duration: var(--star-duration);
  will-change: transform;
}

@keyframes risingStarsAnimation {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-2000px);
  }
}
</style>


================================================
FILE: docs/app/error.vue
================================================
<script setup lang="ts">
import type { NuxtError } from '#app'

interface ComponentProps {
  error: NuxtError
}

defineProps<ComponentProps>()

useHead({
  htmlAttrs: {
    lang: 'en'
  }
})

useSeoMeta({
  title: 'Page not found',
  description: 'We are sorry but this page could not be found.'
})

const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('docs'))
const { data: files } = useLazyAsyncData(
  'search', () => queryCollectionSearchSections('docs'),
  { server: false }
)

provide('navigation', navigation)
</script>

<template>
  <UApp>
    <AppHeader />

    <UError :error="error" />

    <AppFooter />

    <ClientOnly>
      <LazyUContentSearch
        :files="files"
        :navigation="navigation"
      />
    </ClientOnly>
  </UApp>
</template>


================================================
FILE: docs/app/layouts/docs.vue
================================================
<script setup lang="ts">
import type { ContentNavigationItem } from '@nuxt/content'

const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
</script>

<template>
  <UContainer>
    <UPage>
      <template #left>
        <UPageAside>
          <UContentNavigation
            highlight
            :navigation="navigation"
          />
        </UPageAside>
      </template>

      <slot />
    </UPage>
  </UContainer>
</template>


================================================
FILE: docs/app/pages/[...slug].vue
================================================
<script setup lang="ts">
import type { ContentNavigationItem } from '@nuxt/content'
import { findPageHeadline } from '@nuxt/content/utils'

definePageMeta({
  layout: 'docs'
})

const route = useRoute()
const { toc } = useAppConfig()
const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')

const { data: page } = await useAsyncData(
  route.path,
  () => queryCollection('docs').path(route.path).first()
)

if (!page.value) {
  throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
}

const { data: surround } = await useAsyncData(
  `${route.path}-surround`,
  () => {
    return queryCollectionItemSurroundings(
      'docs',
      route.path,
      { fields: ['description'] }
    )
  }
)

const title = page.value.seo?.title || page.value.title
const description = page.value.seo?.description || page.value.description

useSeoMeta({
  title,
  ogTitle: title,
  description,
  ogDescription: description
})

const headline = computed(() => findPageHeadline(navigation?.value, page.value?.path))

defineOgImageComponent(
  'Docs',
  {
    headline: headline.value
  }
)

const links = computed(() => {
  const links = []

  if (toc?.bottom?.edit) {
    links.push({
      icon: 'i-lucide-external-link',
      label: 'Edit this page',
      to: `${toc.bottom.edit}/${page?.value?.stem}.${page?.value?.extension}`,
      target: '_blank'
    })
  }

  return [
    ...links,
    ...(toc?.bottom?.links || [])
  ].filter(Boolean)
})
</script>

<template>
  <UPage v-if="page">
    <UPageHeader
      :title="page.title"
      :description="page.description"
      :headline="headline"
    >
      <template #links>
        <UButton
          v-for="(link, index) in page.links"
          :key="index"
          v-bind="link"
        />
      </template>
    </UPageHeader>

    <UPageBody>
      <ContentRenderer
        v-if="page"
        :value="page"
      />

      <USeparator v-if="surround?.length" />

      <UContentSurround :surround="surround" />
    </UPageBody>

    <template
      v-if="page?.body?.toc?.links?.length"
      #right
    >
      <UContentToc
        :title="toc?.title"
        :links="page.body?.toc?.links"
      >
        <template
          v-if="toc?.bottom"
          #bottom
        >
          <div
            class="hidden lg:block space-y-6"
            :class="{ '!mt-6': page.body?.toc?.links?.length }"
          >
            <USeparator
              v-if="page.body?.toc?.links?.length"
              type="dashed"
            />

            <UPageLinks
              :title="toc.bottom.title"
              :links="links"
            />
          </div>
        </template>
      </UContentToc>
    </template>
  </UPage>
</template>


================================================
FILE: docs/app/pages/index.vue
================================================
<script setup lang="ts">
const { data: page } = await useAsyncData('index', () => queryCollection('landing').path('/').first())

if (!page.value) {
  throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
}

const title = page.value.seo?.title || page.value.title
const description = page.value.seo?.description || page.value.description

useSeoMeta({
  titleTemplate: '',
  title,
  ogTitle: title,
  description,
  ogDescription: description
})

defineOgImageComponent(
  'Docs',
  {
    headline: 'Nuxt Laravel Sanctum'
  }
)
</script>

<template>
  <ContentRenderer
    v-if="page"
    :value="page"
    :prose="false"
  />
</template>


================================================
FILE: docs/content/1.getting-started/.navigation.yml
================================================
title: Getting Started
icon: false


================================================
FILE: docs/content/1.getting-started/1.index.md
================================================
---
title: Introduction
description: Welcome to Nuxt Laravel Sanctum module documentation
navigation:
  icon: i-simple-icons-laravel
---

This module provides a simple way to use Laravel Sanctum with Nuxt. SSR-ready!

## Key Features

This module includes a range of features designed to streamline authentication:

- `useSanctumAuth` composable for easy access to the current user and authentication methods
- `useSanctumFetch` and `useLazySanctumFetch` to load data from your API
- Automated `CSRF` token header and cookie management
- Automated `Bearer` token header management
- Both `CSR` and `SSR` modes support
- Pre-configured middleware for pages that require authentication
- Cast current user information to any class you want
- Custom `request` and `response` interceptors
- Subscribe to `sanctum:*` hooks to react as you want
- Compatible with default Nuxt `ofetch` client
- TypeScript support
- ... and more, check the docs!

::warning
---
target: _blank
to: https://laravel.com/docs/10.x/sanctum#spa-authentication
---
**Note**: Before using this module, please ensure you have configured Laravel Sanctum on your backend. 
You can find more information about Laravel Sanctum here.
::

We recommend looking at our [breeze-nuxt](https://github.com/manchenkoff/breeze-nuxt) template that works flawlessly with 
[breeze-api](https://github.com/manchenkoff/breeze-api) Laravel application with preconfigured Sanctum and Echo modules.

## Ecosystem

This project is a part of Nuxt Laravel modules ecosystem which you may find useful:

::card-group
  :::card
  ---
  icon: i-lucide-lock
  target: _blank
  title: Sanctum
  to: https://github.com/manchenkoff/nuxt-auth-sanctum
  ---
  Module for Sanctum authentication
  :::

  :::card
  ---
  icon: i-lucide-radio
  target: _blank
  title: Echo
  to: https://github.com/manchenkoff/nuxt-laravel-echo
  ---
  Module for Echo broadcasting
  :::

  :::card
  ---
  icon: i-lucide-badge-check
  target: _blank
  title: Precognition
  to: https://github.com/manchenkoff/nuxt-sanctum-precognition
  ---
  Module for Precognition form validation and Nuxt UI support, based on Sanctum
  :::

  :::card
  ---
  icon: i-simple-icons-nuxt
  target: _blank
  title: Breeze Nuxt
  to: https://github.com/manchenkoff/breeze-nuxt
  ---
  Nuxt application starter with configured modules for Laravel
  :::

  :::card
  ---
  icon: i-simple-icons-laravel
  target: _blank
  title: Breeze API
  to: https://github.com/manchenkoff/breeze-api
  ---
  Laravel API application starter with preconfigured Sanctum, Echo and Precognition
  :::
::

## Support

If you like this module, please support the project to help me maintain and improve it!

<a href="https://www.buymeacoffee.com/manchenkoff" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>




================================================
FILE: docs/content/1.getting-started/2.installation.md
================================================
---
title: Installation
description: How to add nuxt-auth-sanctum to your Nuxt application!
navigation:
  icon: i-lucide-download
---

## Quick Start

You can use the following command to install the module 
and automatically register it in your `nuxt.config.ts` modules section

```bash [Terminal]
npx nuxi@latest module add nuxt-auth-sanctum
```

or manually install a dependency via:

```bash [Terminal]
pnpm add nuxt-auth-sanctum
```

and register the module in your `nuxt.config.ts`:

```typescript [nuxt.config.ts]
export default defineNuxtConfig({
  modules: [
    // other modules
    'nuxt-auth-sanctum'
  ],

  sanctum: {},
})
```

## Configuration

Once you have the module installed and registered, provide the
configuration in `nuxt.config.ts` according to your setup.

```typescript [nuxt.config.ts]
export default defineNuxtConfig({
  //... other parts of the config

  // nuxt-auth-sanctum options (also configurable via environment variables)
  sanctum: {
    baseUrl: 'http://localhost:80', // Laravel API
  }
})
```

That's it! You can now use Nuxt Auth Sanctum in your Nuxt app ✨


================================================
FILE: docs/content/2.usage/1.configuration.md
================================================
---
title: Configuration
description: How to configure nuxt-auth-sanctum for Nuxt
navigation:
  icon: i-lucide-cog
---

## Initial setup

The only required configuration option is `baseUrl` which will be used for API calls to your Laravel API, 
so you can start using the module with the following definition:

```typescript [nuxt.config.ts]
export default defineNuxtConfig({
    modules: ['nuxt-auth-sanctum'],

    sanctum: {
        baseUrl: 'http://localhost:80', // Laravel API
    },
})
```

## Available options

For any additional configurations, you can adjust the next list of available parameters:

| Parameter | Description | Default |
| --------- | ----------- | ------- |
| `baseUrl` | The base URL of the Laravel API | `undefined` |
| `mode` | Authentication mode to work with Laravel API. Supported values - `cookie`, `token`. | `cookie` |
| `origin` | The URL of the current application to use in Referrer header | `useRequestUrl().origin` |
| `userStateKey` | The key to use to store the user identity in the `useState` variable. | `sanctum.user.identity` |
| `redirectIfAuthenticated` | Determine whether to redirect the user if it is already authenticated on a login attempt. | `false` |
| `redirectIfUnauthenticated` | Determine whether to redirect when the user got unauthenticated on any API request. | `false` |
| `endpoints.csrf` | The endpoint to request a new CSRF token | `/sanctum/csrf-cookie` |
| `endpoints.login` | The endpoint to send user credentials to authenticate | `/login` |
| `endpoints.logout` | The endpoint to destroy current user session | `/logout` |
| `endpoints.user` | The endpoint to fetch current user data | `/api/user` |
| `csrf.cookie` | Name of the CSRF cookie to extract from server response | `XSRF-TOKEN` |
| `csrf.header` | Name of the CSRF header to pass from client to server | `X-XSRF-TOKEN` |
| `client.retry` | The number of times to retry a request when it fails | `false` |
| `client.initialRequest` | Determines whether to request the user identity on plugin initialization | `true` |
| `redirect.keepRequestedRoute` | Determines whether to keep the requested route when redirecting after login | `false` |
| `redirect.onLogin` | Route to redirect to when user is authenticated. If set to false, do nothing | `/` |
| `redirect.onLogout` | Route to redirect to when user is not authenticated. If set to false, do nothing | `/` |
| `redirect.onAuthOnly` | Route to redirect to when user has to be authenticated. If set to false, do nothing | `/login` |
| `redirect.onGuestOnly` | Route to redirect to when user has to be a guest. If set to false, do nothing | `/` |
| `globalMiddleware.enabled` | Determines whether the global middleware is enabled | `false` |
| `globalMiddleware.prepend` | Determines whether the global middleware is prepended to the list of middlewares | `false` |
| `globalMiddleware.allow404WithoutAuth` | Determines whether to allow 404 page without authentication | `true` |
| `logLevel` | The level to use for the logger. More details [here](/advanced/logging). | `3` |
| `appendPlugin` | Determines whether to append the plugin to the Nuxt application. More details [here](https://nuxt.com/docs/api/kit/plugins#options). | `false` |
| `serverProxy.enabled` | Determines whether the server side proxy is enabled. Available on server-side only. | `false` |
| `serverProxy.route` | Nuxt server route to catch all requests. This route will receive any nested path as well. Available on server-side only. | `/api/sanctum` |
| `serverProxy.baseUrl` | The base URL of the Laravel API. Available on server-side only. | `http://localhost:80` |

For more details, please check the source code - [options.ts](https://github.com/manchenkoff/nuxt-auth-sanctum/blob/main/src/runtime/types/options.ts).

## Overrides

You can override any of these options in the `nuxt.config.ts` file:

```typescript [nuxt.config.ts]
export default defineNuxtConfig({
    modules: ['nuxt-auth-sanctum'],

    sanctum: {
        baseUrl: 'http://localhost:80', // Your Laravel API
        redirect: {
            onLogin: '/dashboard', // Custom route after successful login
        },
    },
})
```

## RuntimeConfig

Module configuration is exposed to `runtimeConfig` property of your Nuxt app,
so you can override either in sanctum module config or `runtimeConfig.public.sanctum` property.

```typescript [nuxt.config.ts]
export default defineNuxtConfig({
    modules: ['nuxt-auth-sanctum'],

    runtimeConfig: {
        public: {
            sanctum: {
                baseUrl: 'http://localhost:80',
            },
        },
    },
})
```

## Server vs Client Configuration

The module supports different configurations for server-side (SSR) and client-side (CSR) contexts.

### Configuration Priority

| Context | Priority (highest to lowest) |
|---------|------------------------------|
| Server | `runtimeConfig.sanctum` → `runtimeConfig.public.sanctum` → module defaults |
| Client | `runtimeConfig.public.sanctum` → module defaults |

### Examples

**Shared config** (same for both server and client):
```typescript [nuxt.config.ts]
runtimeConfig: {
    public: {
        sanctum: {
            baseUrl: 'http://localhost:80',
        },
    },
}
```

**Different config** (server vs client):
```typescript [nuxt.config.ts]
export default defineNuxtConfig({
    modules: ['nuxt-auth-sanctum'],

    // Default values for both server and client
    sanctum: {
        baseUrl: 'http://localhost:80',
        logLevel: 3,
    },

    // Server-specific overrides
    runtimeConfig: {
        sanctum: {
            baseUrl: 'http://laravel:80',  // Docker internal URL
            logLevel: 4,                   // Verbose server logs
        },

        // Client-specific overrides
        public: {
            sanctum: {
                baseUrl: 'https://myapp.com',  // Public TLD
                logLevel: 2,                   // Minimal client logs
            }
        }
    },
})
```

### Server-Only Options

The following options are only available on the server-side:
- `serverProxy.enabled`
- `serverProxy.route`
- `serverProxy.baseUrl`

## Environment variables

It is possible to override options via environment variables too. 
It might be useful when you want to use `.env` file to provide baseUrl for Laravel API.

::warning
If you are using SSR (Server-Side Rendering) and relying *entirely* on `.env` files rather than hardcoding the `baseUrl` in your `nuxt.config.ts`, you **must** provide both the public and private environment variables. Otherwise, the server-side fetch will not see the public variable and the page will hang indefinitely with an infinite loop of SSR requests.
::

Here is what it should look like in your `.env` file:

```env [.env]
# Used by the browser (CSR)
NUXT_PUBLIC_SANCTUM_BASE_URL='http://localhost:8000'

# Used by the Nuxt server (SSR)
NUXT_SANCTUM_BASE_URL='http://localhost:8000'
```

::warning
The `origin` option requires a static default in `nuxt.config.ts` for environment
variables to work. Unlike other options, Nuxt ignores env var overrides for keys
that are `undefined` by default.

```typescript
sanctum: {
    origin: 'http://localhost:3000', // Set static default first
}
```

Then in your `.env`:
```env
# For client-side (CSR)
NUXT_PUBLIC_SANCTUM_ORIGIN=https://your-domain.com

# For server-side (SSR)
NUXT_SANCTUM_ORIGIN=https://your-domain.com
```

Note: `NUXT_PUBLIC_SANCTUM_ORIGIN` only affects client-side, while `NUXT_SANCTUM_ORIGIN`
only affects server-side.
::


## Configuration example

Here is an example of a full module configuration

```typescript [nuxt.config.ts]
export default defineNuxtConfig({
    modules: ['nuxt-auth-sanctum'],

    sanctum: {
        mode: 'cookie',
        userStateKey: 'sanctum.user.identity',
        redirectIfAuthenticated: false,
        redirectIfUnauthenticated: false,
        endpoints: {
            csrf: '/sanctum/csrf-cookie',
            login: '/login',
            logout: '/logout',
            user: '/api/user',
        },
        csrf: {
            cookie: 'XSRF-TOKEN',
            header: 'X-XSRF-TOKEN',
        },
        client: {
            retry: false,
            initialRequest: true,
        },
        redirect: {
            keepRequestedRoute: false,
            onLogin: '/',
            onLogout: '/',
            onAuthOnly: '/login',
            onGuestOnly: '/',
        },
        globalMiddleware: {
            enabled: false,
            allow404WithoutAuth: true,
        },
        logLevel: 3,
        appendPlugin: false,
    }
})
```



================================================
FILE: docs/content/2.usage/2.cookie.md
================================================
---
title: Cookie Authentication
description: Set up cookie CSRF authentication for Sanctum
navigation:
  icon: i-lucide-cookie
---

## Usage

By default, the module provides configuration to integrate seamlessly with Laravel Sanctum authentication based on the XSRF token.

To explicitly set this authentication mode, update `sanctum.mode` configuration property to `cookie`.

You can check the official Laravel documentation here - [SPA Authentication](https://laravel.com/docs/12.x/sanctum#spa-authentication).

::warning
Nuxt and Laravel applications must share the same top-level domain. For instance:
- Nuxt application - `domain.com`
- Laravel application - `api.domain.com`
::

## How it works

First, you need to authenticate a user by submitting credentials to `endpoints.login` endpoint:

```typescript
const { login } = useSanctumAuth()

const credentials = {
    email: "john@doe.com",
    password: "password",
    remember: true,
}

await login(credentials)
```

The client will be automatically redirected to `redirect.onLogin` route of your application.

Once the module has an authentication state, it will take care of requesting a CSRF cookie from the API 
and passing it as an XSRF header to each subsequent request as well as passing all other 
headers and cookies from CSR to SSR requests.

You can also [extend default interceptors](/advanced/interceptors) 
and add your information into headers or cookie collections.

To check other available methods, please refer to the composables section.

## Laravel configuration

Your Laravel API should be configured properly to support Nuxt domain and share cookies:

- The Nuxt application domain should be registered in `stateful` domain list (`SANCTUM_STATEFUL_DOMAINS`)
- The Nuxt application domain should be registered in `config/cors.php` in `allowed_origins` domain list
- Also `config/cors.php` configuration should have `support_credentials=true`
- Sanctum `statefulApi` middleware should be enabled
- The top-level domain should be used for the session (`SESSION_DOMAIN=.domain.com`), or `localhost` during development (without port)

If you notice incorrect behavior of the module or authentication flow, 
feel free to [raise an issue](https://github.com/manchenkoff/nuxt-auth-sanctum/issues/new/choose)!


================================================
FILE: docs/content/2.usage/3.token.md
================================================
---
title: Token Authentication
description: Set up cookie Bearer token authentication for Sanctum
navigation:
  icon: i-lucide-shield
---

## Usage

::caution
Beware, that token-based authentication is not recommended for SPA applications.
::

Sometimes, token authentication might be useful when you cannot host your application on the same TLD 
or have a mobile or desktop application built with Nuxt (e.g. based on Capacitor).

To explicitly set this authentication mode, update `sanctum.mode` configuration property to `token`.

You can check the official Laravel documentation here - [API Token Authentication](https://laravel.com/docs/12.x/sanctum#api-token-authentication).

## How it works

First, you need to authenticate a user by submitting credentials to `endpoints.login` endpoint:

```typescript
const { login } = useSanctumAuth()

const credentials = {
    email: "john@doe.com",
    password: "password",
    remember: true,
}

await login(credentials)
```

The client will be automatically redirected to `redirect.onLogin` route of your application.

To check other available methods, please refer to the **composables** section.

The module expects a plain token value in the response from the API that can be stored in 
cookies to be included in all subsequent requests as `Authorization` header.

You can also implement your [own token storage](https://sanctum.manchenkoff.me/advanced/token-storage) 
if cookies are not supported, for example - *Capacitor, Ionic, LocalStorage, etc*.

## Laravel configuration

Your API should have at least two endpoints for login and logout which are included in `api.php` routes, 
so make sure that you do not use the same endpoints as for cookie-based authentication (`web.php` routes) 
to avoid **CSRF token mismatch** errors.

```php [routes/api.php]
<?php 

Route::middleware(['guest'])->post('/login', [TokenAuthenticationController::class, 'store']);
Route::middleware(['auth:sanctum'])->post('/logout', [TokenAuthenticationController::class, 'destroy']);
```

::warning
Keep in mind, that the domain where API requests are coming from should not be 
included in `SANCTUM_STATEFUL_DOMAINS` variable, otherwise you will get a **CSRF mismatch error**.
::

The login endpoint must return a JSON response that contains `token` key like this

```json
{
    "token": "<plain_token_value>"
}
```

Here you can find an example from official documentation - [Issue API Token](https://laravel.com/docs/12.x/sanctum#issuing-api-tokens).

The logout endpoint should revoke the current client token to avoid inconsistencies with your Nuxt application state, 
please check official documentation - [Revoke API Tokens](https://laravel.com/docs/12.x/sanctum#revoking-tokens).

::tip
You can also try our API template with the already implemented authentication 
logic for both cookie and token approach - [breeze-nuxt](/advanced/breeze-nuxt-template).
::

## Custom token storage

Default token storage uses cookies to keep the API Authentication token and automatically load it for both CSR and SSR requests. 
However, you are free to define custom storage in your `app.config.ts` by implementing an interface.

Check this section for more details - [Token storage](/advanced/token-storage).


================================================
FILE: docs/content/2.usage/4.proxy.md
================================================
---
title: Server Proxy
description: How to use your Nuxt app as a proxy for Sanctum API requests
navigation:
  icon: i-lucide-waypoints
---

## Usage

When using **SSR**, it's often convenient to serve all operations under a single domain. 
You can achieve this by enabling the **server proxy catch-all** feature, 
which forwards client requests to your Laravel API while preserving cookies and headers.

To enable it, update your `nuxt.config.ts`:

```typescript [nuxt.config.ts]
export default defineNuxtConfig({
  modules: ['nuxt-auth-sanctum'],
  
  ssr: true,
  
  sanctum: {
    baseUrl: '/api/sanctum',
    serverProxy: {
      enabled: true,
      route: '/api/sanctum',
      baseUrl: 'http://api.frontend.dev',
    },
  },
})
```

Once `serverProxy.enabled` is set to `true`, Nuxt adds a server route at: `http://frontend.dev/api/sanctum`
which is defined as `serverProxy.route` parameter.

Note that `sanctum.baseUrl` is now `/api/sanctum` (a local path), while `serverProxy.baseUrl` points to your Laravel backend. 
This setup tells Nuxt where to forward requests internally.

You can test the proxy using any helper like `useSanctumFetch`:

```typescript
// Request URL = http://frontend.dev/api/sanctum/user/profile
// Actual URL = http://api.frontend.dev/user/profile

const { data } = await useSanctumFetch('/user/profile')
```

The catch-all route (`/api/sanctum`) is stripped from the final proxied URL. 
If needed, you can customise this behaviour by modifying `serverProxy.baseUrl`.


================================================
FILE: docs/content/3.composables/1.useSanctumAuth.md
================================================
---
title: useSanctumAuth
description: How to use useSanctumAuth composable to work with state
navigation:
  icon: i-lucide-parentheses
---

## Usage

Composable provides 2 computed properties and 4 methods:

- `user` - currently authenticated user (basically the same as `useSanctumUser`)
- `isAuthenticated` - a boolean flag indicating whether the user is authenticated or not
- `login` - method for logging in the user
- `logout` - method for logging out the user
- `refreshIdentity` - method for manually re-fetching current authenticated user data

To authenticate a user you should pass the credentials payload as an argument to the `login` method.
The payload should contain all fields required by your Laravel Sanctum backend.

```typescript
const { login } = useSanctumAuth();

const userCredentials = {
  email: "user@mail.com",
  password: "123123",
}

await login(userCredentials)
```

If the login operation was successful, the `user` property will be updated with
the current user information returned by the Laravel API.

If you do not want to update the `user` property automatically (e.g. *for 2FA authentication*),
you can disable identity fetching by passing optional argument to `login` method:

```typescript
// user identity will not be loaded after successful response
await login(userCredentials, false) 
```

By default, methods will use the following Laravel endpoints:

- `/login` to authenticate the user
- `/logout` to log out the user
- `/api/user` to get the current user information
- `/sanctum/csrf-cookie` to get the `CSRF` token cookie

To change the default endpoints, please check the [Configuration](/usage/configuration) section.

### Additional `fetch` options

If you want to pass additional header or change HTTP method for either `login` or `logout` calls, 
you can pass optional `options: SanctumFetchOptions` argument.

For example, to log out the user with `DELETE` method instead of default `POST`:

```typescript
const { logout } = useSanctumAuth()

await logout({ method: "DELETE" })
```

Use the same approach when you need to pass additional params to `login` call:

```typescript
const { login } = useSanctumAuth()

const userCredentials = {
  email: "user@mail.com",
  password: "123123",
}

await login(
    userCredentials, 
    false, 
    { headers: { "X-Custom-Header": "header_value" } }
)
```


================================================
FILE: docs/content/3.composables/2.useSanctumUser.md
================================================
---
title: useSanctumUser
description: How to use useSanctumUser composable to work with authenticated user
navigation:
  icon: i-lucide-parentheses
---

## Usage

This composable provides access to the current authenticated user. 
It supports generic types, so you can get the user as any class you want.

```typescript
interface MyCustomUser {
    id: number;
    login: string;
    custom_metadata: {
        group: string;
        role: string;
    };
}

const user = useSanctumUser<MyCustomUser>();
```

If there is no authenticated user, the composable will return `null`.



================================================
FILE: docs/content/3.composables/3.useSanctumClient.md
================================================
---
title: useSanctumClient
description: How to use useSanctumClient to work with preconfigured fetch client
navigation:
  icon: i-lucide-parentheses
---

## Usage

All previous composables work on top of the `ofetch` client which can be used in your application as well. 
The client is pre-configured with `CSRF` token header and cookie management.

All requests will be sent to the `baseUrl` specified in the [Configuration](/usage/configuration) section.

```typescript
const client = useSanctumClient();

const { data, status, error, refresh } = await useAsyncData('users', () =>
    client('/api/users')
);
```

Since client implements `$Fetch` interface, you can use it as a regular `ofetch` client. 
Check examples in the ofetch [documentation](https://github.com/unjs/ofetch?tab=readme-ov-file#%EF%B8%8F-create-fetch-with-default-options).




================================================
FILE: docs/content/3.composables/4.useSanctumFetch.md
================================================
---
title: useSanctumFetch
description: How to use useSanctumFetch to fetch data from Laravel API
navigation:
  icon: i-lucide-parentheses
---

## Usage

Besides `useSanctumClient` you can directly send a request by using a module-specific
version of fetch composable - `useSanctumFetch`.

This composable implements an API-specific `useFetch`, so you can check more details [here](https://nuxt.com/docs/api/composables/use-fetch).

Composable accepts 2 arguments:

- `url`: target endpoint to call (type: `MaybeRefOrGetter<string>`)
- `options`: fetch options for client (type: `UseFetchOptions<T>`)

```typescript
const { data, status, error, refresh } = await useSanctumFetch("/api/users")

// or

const { data, status, error, refresh } = await useSanctumFetch("/api/users", {
  pick: ["id"],
  method: "GET",
  query: {
    is_active: true,
  },
})
```

You can also use type casting to work with the response as an interface:

```typescript
interface MyResponse {
  name: string
}

const { data } = await useSanctumFetch<MyResponse>("/api/endpoint")

const name = data.value.name // augmented by MyResponse interface
```


================================================
FILE: docs/content/3.composables/5.useLazySanctumFetch.md
================================================
---
title: useLazySanctumFetch
description: How to use useLazySanctumFetch to fetch data from Laravel API
navigation:
  icon: i-lucide-parentheses
---

## Usage

Besides `useSanctumClient` you can directly send a request by using a module-specific
version of fetch composable - `useLazySanctumFetch`.

This composable implements an API-specific `useLazyFetch`, so you can check more details [here](https://nuxt.com/docs/api/composables/use-fetch).

Composable accepts 2 arguments:

- `url`: target endpoint to call (type: `MaybeRefOrGetter<string>`)
- `options`: fetch options for client (type: `UseFetchOptions<T>`)

```typescript
const { data, status, error, refresh } = await useLazySanctumFetch("/api/users")

// or

const { data, status, error, refresh } = await useLazySanctumFetch(
  "/api/users",
  {
    method: "GET",
    query: { page: 1 },
    default() {
      return {
        data: [],
        meta: {
          total: 0,
          per_page: 0,
        },
      }
    },
  },
)
```

You can also use type casting to work with the response as an interface:

```typescript
interface MyResponse {
  name: string
}

const { data } = await useLazySanctumFetch<MyResponse>("/api/endpoint")

const name = data.value.name // augmented by MyResponse interface
```


================================================
FILE: docs/content/3.composables/6.useSanctumConfig.md
================================================
---
title: useSanctumConfig
description: How to use useSanctumConfig to retrieve module configuration
navigation:
  icon: i-lucide-parentheses
---

## Usage

This composable provides quick access to the module configuration instead of
using `useRuntimeConfig` and several keys like `public.sanctum`.

The composable is **context-aware** - it automatically returns the appropriate configuration based on where it's executed:

- **Server-side (SSR)**: Returns `runtimeConfig.sanctum` configuration
- **Client-side (CSR)**: Returns `runtimeConfig.public.sanctum` configuration

This allows you to have different settings for server and client contexts (e.g., different `baseUrl` for Docker internal network vs public TLD).

```typescript
const config = useSanctumConfig();

// On server: runtimeConfig.sanctum.baseUrl
// On client: runtimeConfig.public.sanctum.baseUrl
console.log(config.baseUrl);
```

More details about the configuration structure can be found [here](/usage/configuration).


================================================
FILE: docs/content/3.composables/7.useSanctumAppConfig.md
================================================
---
title: useSanctumAppConfig
description: How to use useSanctumAppConfig to retrieve module application configuration
navigation:
  icon: i-lucide-parentheses
---

## Usage

This composable provides quick access to the module configuration instead of using `useAppConfig().sanctum`. 

Take a look at the following example

```typescript
const config = useSanctumAppConfig();

console.log(config.interceptors.onRequest); // appConfig.sanctum.interceptors.onRequest
```

More details about the configuration structure can be found [here](/usage/configuration).



================================================
FILE: docs/content/4.middleware/1.sanctum-auth.md
================================================
---
title: sanctum:auth
description: How to protect pages from unauthenticated users
navigation:
  icon: i-lucide-user-lock
---

## Usage

This middleware checks if the user is authenticated. 
If not, it will redirect a user to the page specified in the `redirect.onAuthOnly` option (default is `/login`).

Also, you might want to remember what page the **user was trying to access** 
and redirect him back to that page after successful authentication. 
To do that, just enable the `redirect.keepRequestedRoute` option and 
it will be automatically stored in the URL for later redirect.

If there is no redirect rule the middleware will throw `403` error.

## Example

This is an example of middleware usage

```vue [app/pages/dashboard.vue]
<script lang="ts" setup>
definePageMeta({
    middleware: ['sanctum:auth'],
});
</script>

<template>
    <!-- Page for authenticated users only -->
</template>

<style scoped></style>
```


================================================
FILE: docs/content/4.middleware/2.sanctum-guest.md
================================================
---
title: sanctum:guest
description: How to protect pages from authenticated users
navigation:
  icon: i-lucide-lock-open
---

## Usage

This middleware checks if the user is not authenticated. 
If not, it will redirect a user to the page specified in the `redirect.onGuestOnly` option (default is `/`).

If there is no redirect rule the middleware will throw `403` error.

## Example

This is an example of middleware usage

```vue [app/pages/login.vue]
<script lang="ts" setup>
definePageMeta({
    middleware: ['sanctum:guest'],
});
</script>

<template>
    <!-- Page for guests only -->
</template>

<style scoped></style>
```


================================================
FILE: docs/content/4.middleware/3.global.md
================================================
---
title: Global middleware
description: How to configure global middleware for the whole Nuxt application
navigation:
  icon: i-lucide-shield-check
---

## Usage

Instead of usage `sanctum:auth` and `sanctum:guest` on each page, 
you can enable global middleware that checks every route and restricts unauthenticated access.

The behavior of this middleware is the same as [global middleware](https://nuxt.com/docs/guide/directory-structure/middleware) 
in Nuxt applications.

::warning
Once global middleware is enabled, you can no longer use `sanctum:auth` and `sanctum:guest` on your pages.
::

## Configuration

To enable middleware, use the following configuration in your `nuxt.config.ts`

```typescript [nuxt.config.ts]
export default defineNuxtConfig({
    modules: [
        'nuxt-auth-sanctum'
    ],
    sanctum: {
        baseUrl: 'http://localhost:80',
        redirect: {
            onAuthOnly: '/login',
            onGuestOnly: '/profile',
        },
        globalMiddleware: {
            enabled: true,
        },
    }
})
```

Keep in mind, you must define `onAuthOnly` and `onGuestOnly` routes to help the plugin understand 
which page should be excluded from the middleware.

- `onAuthOnly` - this route is used to redirect unauthenticated users to let them log in, similar to `sanctum:auth` middleware
- `onGuestOnly` - this route is used to redirect already authenticated users, similar to `sanctum:guest` middleware

::tip
You can also set `globalMiddleware.prepend` to true to load it before any other middleware.
::

## Exceptions

If you want to exclude an additional page besides `onAuthOnly` route, 
then you can define page metadata like in the example below:

```typescript
definePageMeta({
    sanctum: {
        excluded: true,
    }
})
```

This page will not be checked by global middleware regardless of user authentication status.

## Guest mode

Sometimes, you may have more than one page which are available only for unauthenticated users, for instance:

- "Sign up" page
- "Forgot my password" page

In these situations, you can use `sanctum.guestOnly` property of the page meta:

```typescript
definePageMeta({
    sanctum: {
        guestOnly: true,
    }
})
```

::warning
Keep in mind, that those pages still will be handled by global middleware to check the user authentication state, 
so for public pages, it is still better to use `sanctum.excluded` to speed up the loading process.
::

## Non-existing routes

By default, when a user requests a non-existing route an error page will be thrown with 404 status, 
but you can also enable redirect to `onAuthOnly` instead by setting `allow404WithoutAuth` to `false`.

```typescript [nuxt.config.ts]
export default defineNuxtConfig({
    modules: [
        'nuxt-auth-sanctum',
    ],
    sanctum: {
        baseUrl: 'http://localhost:80',
        redirect: {
            onAuthOnly: '/login',
            onGuestOnly: '/profile',
        },
        globalMiddleware: {
            enabled: true,
            allow404WithoutAuth: false,
        },
    }
})
```


================================================
FILE: docs/content/5.hooks/1.sanctum-request.md
================================================
---
title: sanctum:request
description: Subscribe to request hook to inject custom event handling
navigation:
  icon: i-lucide-webhook
---

## Usage

When your Nuxt application sends any request against the Laravel API, 
you can subscribe to the `sanctum:request` hook the same way as the ofetch interceptor `onRequest`. 

::tip
More details about interceptors can be found here - [interceptors](/advanced/interceptors).
::

```typescript [app/plugins/sanctum-listener.ts]
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook('sanctum:request', (nuxtApp, context, logger) => {
    logger.info('Sanctum request hook triggered', context.request)
  })
})
```

Here is what the hook looks like

```typescript
interface RuntimeNuxtHooks {
  /**
   * Triggers on every client request.
   */
  'sanctum:request': (app: NuxtApp, ctx: FetchContext, logger: ConsolaInstance) => HookResult
}
```


================================================
FILE: docs/content/5.hooks/10.sanctum-proxy-request.md
================================================
---
title: sanctum:proxy:request
description: Subscribe to request hook to inject custom event handling for proxy endpoint
navigation:
  icon: i-lucide-webhook
---

## Usage

::warning
This hook works only when you use [Server Proxy](/usage/proxy) endpoint.
::

When your Nuxt application sends any request against the Laravel API via proxy endpoint,
you can subscribe to the `sanctum:proxy:request` hook the same way as the ofetch interceptor `onRequest`.

::tip
More details about interceptors can be found here - [interceptors](/advanced/interceptors).
::

```typescript [server/plugins/sanctum-listener.ts]
export default defineNitroPlugin((nuxtApp) => {
  nitroApp.hooks.hook("sanctum:proxy:request", (context, logger) => {
    logger.info("Sanctum proxy request hook triggered", context.request);
  });
});
```

Here is what the hook looks like

```typescript
interface NitroRuntimeHooks {
  /**
   * Triggers on every client proxy request.
   */
  "sanctum:proxy:request": (ctx: FetchContext, logger: ConsolaInstance) => void;
}
```


================================================
FILE: docs/content/5.hooks/2.sanctum-response.md
================================================
---
title: sanctum:response
description: Subscribe to response hook to inject custom event handling
navigation:
  icon: i-lucide-webhook
---

## Usage

When your Laravel API returns any response, you can subscribe to the `sanctum:response` hook 
the same way as the ofetch interceptor `onResponse`. 

::tip
More details about interceptors can be found here - [interceptors](/advanced/interceptors).
::

```typescript [app/plugins/sanctum-listener.ts]
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook('sanctum:response', (nuxtApp, context, logger) => {
    logger.info('Sanctum response hook triggered', context.request)
  })
})
```

Here is what the hook looks like

```typescript
interface RuntimeNuxtHooks {
  /**
   * Triggers on every server response.
   */
  'sanctum:response': (app: NuxtApp, ctx: FetchContext, logger: ConsolaInstance) => HookResult
}
```


================================================
FILE: docs/content/5.hooks/3.sanctum-error-request.md
================================================
---
title: sanctum:error:request
description: Subscribe to request error hook to inject custom event handling
navigation:
  icon: i-lucide-webhook
---

## Usage

When you send a request to the API, it could raise an exception even before reaching the remote server. 
For these cases, `ofetch` uses `onRequestError`. All these errors are available via `sanctum:error:request` hook.

```typescript [app/plugins/sanctum-listener.ts]
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook('sanctum:error:request', (context) => {
    console.log('Sanctum request error hook triggered', context)
  })
})
```

Here is what the hook looks like

```typescript
interface RuntimeNuxtHooks {
  /**
   * Triggers when receiving an error on fetch request.
   */
  'sanctum:error:request': (context: FetchContext) => HookResult
}
```


================================================
FILE: docs/content/5.hooks/4.sanctum-error-response.md
================================================
---
title: sanctum:error:response
description: Subscribe to response error hook to inject custom event handling
navigation:
  icon: i-lucide-webhook
---

## Usage

When you send a request to Laravel API using any available module's composable, 
it may return an error, such as 401, 419, 403, 404, etc.

::tip
By default, `nuxt-auth-sanctum` will try to redirect a user if 401 is returned. 
Unless you disable this by setting `sanctum.redirectIfUnauthenticated` to `false` in your `nuxt.config.ts` file.
::

However, if you need more granular control over API errors, you can subscribe to the `sanctum:error` hook and 
process the HTTP response according to your requirements.

```typescript [app/plugins/sanctum-listener.ts]
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook('sanctum:error:response', (response) => {
    console.log('Sanctum error hook triggered', response)
  })
})
```

Here is what the hook looks like

```typescript
interface RuntimeNuxtHooks {
  /**
   * Triggers when receiving an error response.
   */
  'sanctum:error:response': (response: FetchResponse<any>) => HookResult
}
```


================================================
FILE: docs/content/5.hooks/5.sanctum-redirect.md
================================================
---
title: sanctum:redirect
description: Subscribe to redirect hook to inject custom event handling
navigation:
  icon: i-lucide-webhook
---

## Usage

The module can apply redirects in different situations, like `onLogin` or `onLogout` and you can subscribe 
to this event to keep track of any redirect happening before it is done.

Subscribe to the `sanctum:redirect` hook which receives the URL of the target path of a redirect.

```typescript [app/plugins/sanctum-listener.ts]
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook('sanctum:redirect', (url) => {
    console.log('Sanctum redirect hook triggered', url)
  })
})
```

Here is what the hook looks like

```typescript
interface RuntimeNuxtHooks {
  /**
   * Triggers when user has been redirected.
   */
  'sanctum:redirect': (response: FetchResponse<any>) => HookResult
}
```




================================================
FILE: docs/content/5.hooks/6.sanctum-init.md
================================================
---
title: sanctum:init
description: Subscribe to init hook to inject custom event handling
navigation:
  icon: i-lucide-webhook
---

## Usage

Our module registers a plugin which requests a user identity once an application is started. 
This is needed for middleware and redirects to properly function.

Subscribe to the `sanctum:init` hook which triggers once the identity request is completed.

```typescript [app/plugins/sanctum-listener.ts]
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook('sanctum:init', () => {
    console.log('Sanctum init hook triggered')
  })
})
```

::warning
Keep in mind, since `nuxt-auth-sanctum` is loaded before any other module/plugin, 
you might need to configure your own plugin and set dependencies as described in 
[Plugin dependencies](/advanced/dependencies).
::

Here is what the hook looks like

```typescript
interface RuntimeNuxtHooks {
 /**
  * Triggers when an initial user identity request has been made.
  */
 'sanctum:init': () => HookResult
}
```




================================================
FILE: docs/content/5.hooks/7.sanctum-refresh.md
================================================
---
title: sanctum:refresh
description: Subscribe to refresh hook to inject custom event handling
navigation:
  icon: i-lucide-webhook
---

## Usage

When the authentication state changes (e.g. `onLogin`, `onLogout`), the module has to refresh the user identity.

Subscribe to the `sanctum:refresh` hook which triggers once the identity refresh request is completed.

```typescript [app/plugins/sanctum-listener.ts]
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook('sanctum:refresh', () => {
    console.log('Sanctum refresh hook triggered')
  })
})
```

Here is what the hook looks like

```typescript
interface RuntimeNuxtHooks {
 /**
  * Triggers when user identity has been refreshed.
  */
 'sanctum:refresh': () => HookResult
}
```




================================================
FILE: docs/content/5.hooks/8.sanctum-login.md
================================================
---
title: sanctum:login
description: Subscribe to login hook to inject custom event handling
navigation:
  icon: i-lucide-webhook
---

## Usage

Subscribe to the `sanctum:login` hook which triggers once the user is logged in and the identity refresh request is completed.

```typescript [app/plugins/sanctum-listener.ts]
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook('sanctum:login', () => {
    console.log('Sanctum login hook triggered')
  })
})
```

Here is what the hook looks like

```typescript
interface RuntimeNuxtHooks {
 /**
  * Triggers when user successfully logs in.
  */
 'sanctum:login': () => HookResult
}
```




================================================
FILE: docs/content/5.hooks/9.sanctum-logout.md
================================================
---
title: sanctum:logout
description: Subscribe to logout hook to inject custom event handling
navigation:
  icon: i-lucide-webhook
---

## Usage

Subscribe to the `sanctum:logout` hook which triggers once the user is logged out and the identity reset is done.

```typescript [app/plugins/sanctum-listener.ts]
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook('sanctum:logout', () => {
    console.log('Sanctum logout hook triggered')
  })
})
```

Here is what the hook looks like

```typescript
interface RuntimeNuxtHooks {
 /**
  * Triggers when user successfully logs out.
  */
 'sanctum:logout': () => HookResult
}
```




================================================
FILE: docs/content/6.advanced/1.interceptors.md
================================================
---
title: Interceptors
description: Use custom interceptors for the fetch client used for API calls
navigation:
  icon: i-lucide-split
---

## Usage

Interceptors allow you to define custom functions that will be used by [sanctumClient](/composables/usesanctumclient) during API calls. 
Here are some examples of what you can do with it:
- Add custom headers to all requests (e.g. `X-Localization`, `Accept-Language`, etc)
- Use telemetry or logging for requests/responses
- Modify the request payload before sending

::warning
If you are not familiar with [ofetch](https://github.com/unjs/ofetch) interceptors, 
check this [documentation](https://github.com/unjs/ofetch?tab=readme-ov-file#%EF%B8%8F-interceptors) first.
::

## Configuration

This module provides special hooks to define your interceptors:
- `sanctum:request`
- `sanctum:response`

You can set up a new plugin and describe the behaviour of handling each outgoing request and incoming response.

Here is an example of the plugin that writes a log entry for each request and response:

```typescript [app/plugins/sanctum-listener.ts]
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook('sanctum:request', (app, ctx, logger) => {
    logger.info('Sanctum request hook triggered', ctx.request)
  })

  nuxtApp.hook('sanctum:response', (app, ctx, logger) => {
    logger.info('Sanctum response hook triggered', ctx.request)
  })
})
```

Each interceptor receives 3 arguments:
1. `app` - an instance of the current `NuxtApp`
2. `ctx` - `FetchContext` instance for the current operation with access to request, response, and options (*query, headers, etc*)
3. `logger` - an instance of a Consola logger used by the module (will be prefixed with `nuxt-auth-sanctum`)


================================================
FILE: docs/content/6.advanced/2.error-handling.md
================================================
---
title: Error handling
description: How to catch Laravel API errors using this module
navigation:
  icon: i-lucide-bug
---

## Usage

Error handling of API responses is not a part of this module since the main goal is to provide an authentication layer 
and configured API client, but on this page, you can find useful hints.

When Laravel returns an error of any kind (*403, 404, 500, etc*), the module will throw this as an exception 
that has a generic `Error` type. 

::tip
By default, when Laravel API returns a `401` status code, 
**the module will reset the user identity** and redirect to 
`sanctum.redirect.onAuthOnly` route (if `sanctum.redirectIfUnauthenticated` is enabled).
::

## Error type check

This is how you can check what type of error you received

```typescript
import { FetchError } from 'ofetch'

const { login } = useSanctumAuth()

const userCredentials = {
    email: 'user@mail.com',
    password: '123123',
}

async function onCredentialsFormSubmit() {
    try {
        await login(userCredentials)
    } catch (e) {
        if (error instanceof FetchError && error.response?.status === 422) {
           // here you can extract errors from a response 
           // and put it in your form for example
           console.log(e.response?._data.errors)
        }
    }
}
```

Sometimes, it is not convenient, especially when it comes to validation errors in plenty of forms and components.

## Error helper

Here you can get inspiration from error handling specifically for this case and implement it your way.

Create a new composable `useApiError` with the following content:

```typescript [app/composables/useApiError.ts]
import { FetchError } from 'ofetch'

const VALIDATION_ERROR_CODE = 422
const SERVER_ERROR_CODE = 500

export const useApiError = (error: any) => {
    const isFetchError = error instanceof FetchError
    const isValidationError =
        isFetchError && error.response?.status === VALIDATION_ERROR_CODE

    const code = isFetchError ? error.response?.status : SERVER_ERROR_CODE
    const bag: Record<string, string[]> = isValidationError
        ? error.response?._data.errors
        : {}

    return {
        isValidationError,
        code,
        bag,
    }
}
```

Use it as in the next example to extract all the errors from the response and handle it according to your logic:

```typescript
try {
    await login(credentials)
} catch (e) {
    const error = useApiError(e)

    if (error.isValidationError) {
        form.setErrors(error.bag)

        return
    }

    console.error('Request failed not because of a validation', error.code)
}
```

Have a good debugging! 😎


================================================
FILE: docs/content/6.advanced/3.logging.md
================================================
---
title: Logging
description: How to extract useful debug information from the plugin
navigation:
  icon: i-lucide-logs
---

## Usage

Sometimes it might be useful to check the system logs and messages from the plugin, 
especially if you want to check what headers and cookies are being sent. 

All messages will be written in the same manner as regular `console.log` messages 
and can be checked in the browser (for CSR) or in the Node console (for SSR).

By default, the plugin uses `3` as logging level and shows error and informational logs without debugging details. 
You can override `sanctum.logLevel` parameter in the `nuxt.config.ts` and set one of these levels:
- 0 - Fatal and Error 
- 1 - Warnings
- 2 - Normal logs
- 3 - Informational logs
- 4 - Debug logs
- 5 - Trace logs

It follows the convention of the Consola project, 
more details can be found here - [Log Level](https://github.com/unjs/consola?tab=readme-ov-file#log-level).


================================================
FILE: docs/content/6.advanced/4.token-storage.md
================================================
---
title: Token Storage
description: How to work with storage with enabled token-based authentication
navigation:
  icon: i-lucide-vault
---

## Usage

Token storage is used for keeping authentication token value from the Laravel API available
for module consumption during requests assembling.

Storage is used only when `sanctum.mode` equals to `token` in your nuxt configuration:

```typescript [nuxt.config.ts]
export default defineNuxtConfig({
  modules: ["nuxt-auth-sanctum"],

  sanctum: {
    // ...
    mode: "token",
    // ...
  },
});
```

::warning
By default, if there is no custom token storage defined, cookies will be used.
::

## How it works

Each token storage implements the following interface:

```typescript
/**
 * Handlers to work with authentication token.
 */
export interface TokenStorage {
  /**
   * Function to load a token from the storage.
   */
  get: (app: NuxtApp) => Promise<string | undefined>;
  /**
   * Function to save a token to the storage.
   */
  set: (app: NuxtApp, token?: string) => Promise<void>;
}
```

After the user sends credentials to the API module passes a token from the response to `set` method as well as
the current Nuxt application instance to allow calls like `app.runWithConext()`.

Once the user logs out, the module sends `undefined` as a token value to reset the stored value.

Before each request against the API, the module loads the token by calling get method with Nuxt instance passed.

## Define token storage

There are two approaches to define custom token storage:

### Using the `sanctum:storage:token` Hook (Recommended)

The recommended way to define custom token storage is using the `sanctum:storage:token` hook.
This approach works with all builds including `nuxt generate` (e.g. static builds for Capacitor/Ionic apps).

```typescript [plugins/sanctum-storage.client.ts]
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook("sanctum:storage:token", () => {
    const storage = {
      async get(app: NuxtApp) {
        const { Preferences } = await import("@capacitor/preferences");

        const result = await Preferences.get({ key: "sanctum.token" });
        return result.value ?? undefined;
      },
      async set(app: NuxtApp, token?: string) {
        const { Preferences } = await import("@capacitor/preferences");

        if (token) {
          await Preferences.set({ key: "sanctum.token", value: token });
        } else {
          await Preferences.remove({ key: "sanctum.token" });
        }
      },
    };

    useSanctumTokenStorage(storage);
  });
});
```

::tip
For Capacitor/Ionic apps, this is the **only** approach that works with `nuxt generate` because plugins
are compiled by Vite into the JavaScript bundle, preserving the functions.
::

### Using app.config.ts

You can define your own handler in the `app.config.ts` configuration file:

::warning
The `app.config.ts` approach only works in **dev mode** and **Node.js production builds**.
When using `nuxt generate` (static builds for platforms like Capacitor/Ionic), functions are
stripped during JSON serialization and the custom tokenStorage won't work.
::

```typescript [app/app.config.ts]
// LocalStorage example for Laravel Authentication token
const tokenStorageKey = "sanctum.storage.token";
const localTokenStorage: TokenStorage = {
  get: async () => {
    if (import.meta.server) {
      return undefined;
    }

    return window.localStorage.getItem(tokenStorageKey) ?? undefined;
  },

  set: async (app: NuxtApp, token?: string) => {
    if (import.meta.server) {
      return;
    }

    if (!token) {
      window.localStorage.removeItem(tokenStorageKey);
      return;
    }

    window.localStorage.setItem(tokenStorageKey, token);
  },
};

export default defineAppConfig({
  sanctum: {
    tokenStorage: localTokenStorage,
  },
});
```

Now your application will store tokens in a local storage of your browser.

::warning
Keep in mind, `localStorage` is not available for SSR mode, so you should turn it off in your `nuxt.config.ts`.
::

## When to use which approach?

| Approach                          | Works with `nuxt dev` | Works with SSR | Works with `nuxt generate` |
| --------------------------------- | --------------------- | -------------- | -------------------------- |
| Hook + `useSanctumTokenStorage()` | Yes                   | Yes            | Yes                        |
| `app.config.ts`                   | Yes                   | Yes            | No                         |


================================================
FILE: docs/content/6.advanced/5.dependencies.md
================================================
---
title: Plugin dependencies
description: Configuration of plugin dependencies to control load order
navigation:
  icon: i-lucide-link
---

## Usage

Sometimes you might need to use other plugins while making requests against your Laravel API, 
for instance - `i18n` headers enrichment on each sanctum fetch request like this:

```typescript [app/plugins/sanctum-plugin.ts]
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook('sanctum:request', (app, ctx, logger) => {
    ctx
      .options
      .headers
      .set("X-Language", app.$i18n.localeProperties.value.code)
  })
})
```

Since this module cannot know about its dependencies in your application, 
you should use one of the following approaches to configure this behaviour:
- use `sanctum.appendPlugin` to register the Sanctum client plugin only after the previous modules are registered already
- disable an automatic initial user request and call it from your custom plugin with a properly set list of dependencies

## Append plugin

By default, all Nuxt plugins registered by the module use `prepend` operation on a list of plugins, 
which makes it load before other plugins.

To change this behaviour, you can set the `sanctum.appendPlugin` config key to `true` and see 
that the sanctum plugin will be registered after most of the plugins from other modules. 
This is done by using `append` operation instead of `prepend` on the list of plugins.

For more details, please check the Nuxt documentation [here](https://nuxt.com/docs/api/kit/plugins#options).

## Manual initial identity request

Even after changing the loading order of the plugin, there might be some cases when you need more 
granular control of the execution flow of the initial identity requests.

For these kinds of situations, you should disable a plugin initialization request 
by setting `sanctum.client.initialRequest` to `false` and use it in your custom plugin like this:

```typescript [app/plugins/custom-auth.ts]
export default defineNuxtPlugin({
  name: 'custom-auth',
  dependsOn: ['@nuxtjs/i18n', 'nuxt-auth-sanctum'],
  async setup() {
    nuxtApp.hook('sanctum:request', (app, ctx, logger) => {
      ctx
        .options
        .headers
        .set("X-Language", app.$i18n.localeProperties.value.code)
    })
    
    const { init } = useSanctumAuth()
    await init()
  }
})
```

This approach can guarantee that the user's identity will be requested with all dependent plugins loaded properly.

::warning
Beware, in the case of using a custom plugin for identity initial requests, 
you might need to handle API errors on your own (e.g. 401, 419) due to missing CSRF cookie values. 
You can check the default implementation for reference - [identity request error handling](https://github.com/manchenkoff/nuxt-auth-sanctum/blob/main/src/runtime/plugin.ts#L62).
::


================================================
FILE: docs/content/6.advanced/6.breeze-nuxt-template.md
================================================
---
title: Breeze Nuxt Template
description: A quick introduction to the application template based on Nuxt for the Laravel Sanctum API backend. 
navigation:
  icon: i-simple-icons-nuxt
---

## Application template

Suppose you want to start a fresh project based on Nuxt and Laravel Sanctum with Laravel Echo integration. 

In that case, you may consider trying out the template repository that 
has implemented Echo integration and all authentication logic and also contains several pages such as:

- Landing
- Login
- Sign up
- Password reset
- Dashboard

The repository is available here - [breeze-nuxt](https://github.com/manchenkoff/breeze-nuxt), 
follow the guide in the `readme.md` file to set up Laravel API and connect it to the front-end application.

Also, it uses the Nuxt UI module that allows you to start building complex interfaces with ease thanks to predefined components and Tailwind CSS. For more details, check the repository.

As for the backend API part, we also have you covered. 
Check out our [breeze-api](https://github.com/manchenkoff/breeze-api) template.



================================================
FILE: docs/content/6.advanced/7.troubleshooting.md
================================================
---
title: Troubleshooting
description: Follow this guide in case you are experiencing unexpected behaviour or facing some errors in the module work.
navigation:
  icon: i-lucide-microscope
---

## Usage

Since Laravel Sanctum requires a specific configuration for your application, 
your production might work differently in comparison to a local development environment.

On this page, you can find a description of the most common issues raised on GitHub and 
how to solve them by adjusting either your Laravel or Nuxt application configurations.

## Common problems

First of all, if you experience any unexpected behaviour, we recommend enabling `logLevel: 5` in your `nuxt.config.ts` 
to get more details in SSR (server console) or CSR (browser console) output. 
For more details about logging, please refer to this page - [Logging](/advanced/logging).

In case of misconfiguration on either Nuxt or Laravel side, you may experience:
- Authentication state reset on page reload
- Difference between CSR and SSR state
- Errors while trying to log in
- Failing subsequent requests after successfully logging in

::tip
Before searching for a solution to your problem, we highly recommend double-checking your configuration 
and ensuring that the cache is cleared and your runtime reflects the latest changes.
::

## Known problems

Below you can find the description of the most popular issues, which were already resolved.

### Works on client-side (CSR), but not on server-side (SSR)

If you have SSR enabled, our module sends some of the requests on plugin initialisation before returning content to the client, 
which means we have to proxy some initial request data which might work differently on the server side. 
For example, to fetch user identity we are passing cookies from the initial client request.

::warning
Since CSR and SSR requests are sent from different environments, you have to ensure that your API 
is accessible from both of them and Laravel allow accepting requests from CSR/SSR hosts.
::

If you use a Docker container, make sure that the `sanctum.baseUrl` in your `nuxt.config.ts` is accessible 
from both your web browser and the Nuxt container. We recommend using a domain name as the name 
of the container in the virtual network to avoid side effects. 

::tip
You can check the example here - [breeze-api](https://github.com/manchenkoff/breeze-api/blob/main/docker-compose.yml#L2).
::

In case you use additional software to set up virtual domains for development purposes (e.g. Laravel Valet, Homestead, dnsmasq, etc), 
you may end up with incorrect DNS resolving by Node. We recommend to use `localhost` domain with different ports instead.

### Request blocked by CORS policy

Incorrect CORS configuration on the Laravel side can cause the following problem

::caution
Access to fetch at 'X' from origin 'Y' has been blocked by CORS policy:
The 'Access-Control-Allow-Origin' header has a value 'Z' that is not equal to the supplied origin. 
Have the server send the header with a valid value, or, if an opaque response serves your needs, 
set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
::

In this case, your Nuxt application is calling API endpoint **X** from host **Y**, 
which is not the same as **Z** configured as `allowed_origins` in Laravel's `config/cors.php`.

If you are using Laravel Breeze, then adjusting `FRONTEND_URL` environment variable would be enough.

### Unable to load user identity from API (Code 500 / 403)

If Nuxt cannot retrieve user identity on plugin initialization, that means that either your API is not reachable 
or there is an endpoint misconfiguration.

For example, the following error means that `fetch` could not find a host with `laravel.test` URL due to network problems.

```
Unable to load user identity from API [GET] "https://laravel.test/api/user": <no response> fetch failed
```

You should double-check: 
- URL exists and is reachable, 
- schema is chosen correctly (*http/https*), 
- API port is set correctly (e.g. *80, 8080, 8000, 3000*)
- a Docker container is up and running (if applicable),
- `artisan serve` is using `localhost` instead of `127.0.0.1` (if applicable)

Also, while working locally with enabled SSL, you may face the following error:

```
[nuxt-auth-sanctum:ssr]  ERROR  Unable to load user identity from API [GET] "https://laravel.test/api/user": <no response> fetch failed
[cause]: fetch failed
[cause]: unable to verify the first certificate
```

To enable HTTPS protocol, you might need to set an environment variable `NODE_TLS_REJECT_UNAUTHORIZED=0`.

### Page hangs on load with infinite SSR requests when using only NUXT_PUBLIC_SANCTUM_BASE_URL

If your app never finishes loading and your terminal shows an infinite loop of SSR plugin setup and requests to your base URL with no response, this is likely the cause.

This happens because you defined your API URL in your `.env` file using **only** `NUXT_PUBLIC_SANCTUM_BASE_URL`. Nuxt strictly isolates public and private runtime configurations. When the server attempts to fetch your user identity during SSR, it cannot see the public variable and the request never resolves.

**Fix:** Add `NUXT_SANCTUM_BASE_URL=http://your-api-url` to your `.env` file alongside the public one to ensure the server context uses the correct URL.

### User is not authenticated on plugin initialization (Code 401)

With enabled logging, you can check your Nuxt logs to find errors and warnings about the reason for the 401 response. 
For example, if you see the following message there:

```
[nuxt-auth-sanctum:ssr]  WARN  [response] set-cookie header is missing
[nuxt-auth-sanctum:ssr] ⚙ User is not authenticated on plugin initialization, status: 401
```

then you should check your SANCTUM_STATEFUL_DOMAINS environment variable on the Laravel side. 
If you have a domain different than your Nuxt application is hosted on, it can cause an issue.

### CSRF mismatch (Code 419)

In the logs you can see this entry - **`CSRF token mismatch, check your API configuration`**. 
This error usually occurs if your API returns a 419 status code, 
meaning Laravel expects a different cookie value which in most cases can be solved 
by adjusting the `SANCTUM_STATEFUL_DOMAINS` or `SESSION_DOMAIN` environment variables in your Laravel application.

Keep in mind, that Laravel supports cookies only from the same TLD, meaning you cannot call your API from a different domain. 

For instance:
- frontend app - `https://myapp.com`
- backoffice app - `https://admin.myapp.com`
- Laravel API - `https://api.myapp.com`

In this setup, `SESSION_DOMAIN` should be `.myapp.com` and `SANCTUM_STATEFUL_DOMAINS` should be `myapp.com,admin.myapp.com`.

::warning
If you want to use token authentication, make sure to remove your frontend application 
from stateful domains to avoid CSRF-check middleware.
::

### Missing headers in the API request

If you use `routeRules` and do not see Nuxt passing some of the expected headers to your Laravel API, 
it might be because of proxying behaviour, which is a bit different from the direct fetch request.

Make sure that you also define supported headers in your `nuxt.config.ts` like this:

```typescript [nuxt.config.ts]
export default defineNuxtConfig({
    // ... other config

    routeRules: {
        '/backend/api/**': {
            proxy: {
                to: `http://laravel.test/api/**`,
                headers: { YOUR_HEADER: 'header_value' },
            }
        }
    }
})
```

If you could not find anything useful, 
please check the [Issues](https://github.com/manchenkoff/nuxt-auth-sanctum/issues?q=is%3Aissue%20state%3Aclosed) section on GitHub 
or feel free to [create a new one](https://github.com/manchenkoff/nuxt-auth-sanctum/issues/new?template=bug_report.md)!


================================================
FILE: docs/content/index.md
================================================
---
seo:
  title: Nuxt - Laravel Sanctum
  description: This module provides a simple way to use Laravel Sanctum with Nuxt. SSR-ready!
---

::u-page-hero{class="dark:bg-gradient-to-b from-neutral-900 to-neutral-950"}
---
orientation: horizontal
---
#top
:hero-background

#title
Authenticate users [easily]{.text-primary}.

#description
The only module you need to set up Laravel Sanctum authentication for Nuxt application!

#links
  :::u-button
  ---
  to: /getting-started
  size: xl
  trailing-icon: i-lucide-arrow-right
  ---
  Get started
  :::

  :::u-button
  ---
  icon: i-simple-icons-github
  color: neutral
  variant: outline
  size: xl
  to: https://github.com/sponsors/manchenkoff?o=esb
  target: _blank
  ---
  Support project
  :::

  :::u-button
  ---
  icon: i-simple-icons-buymeacoffee
  color: neutral
  variant: outline
  size: xl
  to: https://buymeacoffee.com/manchenkoff
  target: _blank
  ---
  Buy me a coffee
  :::


#default
  :::prose-pre
  ---
  code: npx nuxi@latest module add nuxt-auth-sanctum
  filename: Install module
  ---

  ```bash
  npx nuxi@latest module add nuxt-auth-sanctum
  ```
  :::
::

::u-page-section{class="dark:bg-neutral-950"}
#title
Features

#links
  :::u-button
  ---
  color: neutral
  size: lg
  to: /getting-started
  trailingIcon: i-lucide-arrow-right
  variant: subtle
  ---
  Explore Nuxt Laravel Sanctum
  :::

#features
  :::u-page-feature
  ---
  icon: i-lucide-cookie
  ---
  #title
  Cookie or Token

  #description
  Automated handling `CSRF` cookies and `Bearer` tokens for authentication
  :::

  :::u-page-feature
  ---
  icon: i-lucide-user-lock
  ---
  #title
  Focus on logic, authentication is on us

  #description
  We provide a lot of useful composables, middleware, fetch utilities, hooks and more...
  :::

  :::u-page-feature
  ---
  icon: i-lucide-layers
  ---
  #title
  CSR + SSR

  #description
  Module supports both client and server rendering!
  :::

  :::u-page-feature
  ---
  icon: i-simple-icons-typescript
  ---
  #title
  TypeScript

  #description
  Code of this module is written entirely in TypeScript and supports autocompletion
  :::

  :::u-page-feature
  ---
  icon: i-lucide-cog
  ---
  #title
  No complex configuration

  #description
  You literally can start using this module by just providing Laravel API URL
  :::

  :::u-page-feature
  ---
  icon: i-lucide-git-pull-request
  ---
  #title
  Open-source

  #description
  Source code is forever-free and open for contributions!
  :::
::

::u-page-section{class="dark:bg-gradient-to-b from-neutral-950 to-neutral-900"}
  :::u-page-c-t-a
  ---
  links:
    - label: Start authenticating
      to: '/getting-started'
      trailingIcon: i-lucide-arrow-right
    - label: View on GitHub
      to: 'https://github.com/manchenkoff/nuxt-auth-sanctum'
      target: _blank
      variant: subtle
      icon: i-simple-icons-github
  title: Ready to build?
  description: Authenticate users with Laravel, Sanctum and Nuxt today!
  class: dark:bg-neutral-950
  ---

  :stars-background
  :::
::



================================================
FILE: docs/content.config.ts
================================================
import { defineContentConfig, defineCollection, z } from '@nuxt/content'

export default defineContentConfig({
  collections: {
    landing: defineCollection({
      type: 'page',
      source: 'index.md'
    }),
    docs: defineCollection({
      type: 'page',
      source: {
        include: '**',
        exclude: ['index.md']
      },
      schema: z.object({
        links: z.array(z.object({
          label: z.string(),
          icon: z.string(),
          to: z.string(),
          target: z.string().optional()
        })).optional()
      })
    })
  }
})


================================================
FILE: docs/eslint.config.mjs
================================================
// @ts-check
import withNuxt from './.nuxt/eslint.config.mjs'

export default withNuxt(
  // Your custom configs here
)


================================================
FILE: docs/nuxt.config.ts
================================================
export default defineNuxtConfig({
  modules: [
    '@nuxt/eslint',
    '@nuxt/image',
    '@nuxt/ui',
    '@nuxt/content',
    'nuxt-og-image',
    'nuxt-llms'
  ],

  devtools: {
    enabled: true
  },

  app: {
    head: {
      script: [
        {
          src: 'https://media.bitterbrains.com/main.js?from=ARTEM&type=top',
          defer: true,
          async: true
        }
      ]
    }
  },

  css: ['~/assets/css/main.css'],

  content: {
    build: {
      markdown: {
        toc: {
          searchDepth: 1
        }
      }
    }
  },

  nitro: {
    prerender: {
      routes: [
        '/'
      ],
      crawlLinks: true,
      autoSubfolderIndex: false
    }
  },

  eslint: {
    config: {
      stylistic: {
        commaDangle: 'never',
        braceStyle: '1tbs'
      }
    }
  },

  icon: {
    provider: 'iconify'
  },

  llms: {
    domain: 'https://sanctum.manchenkoff.me',
    title: 'Nuxt - Laravel Sanctum',
    description: 'The only module you need to set up Laravel Sanctum authentication for Nuxt application!',
    full: {
      title: 'Nuxt - Laravel Sanctum Module Documentation',
      description: 'This is the full documentation for Nuxt Laravel Sanctum module.'
    },
    sections: [
      {
        title: 'Getting Started',
        contentCollection: 'docs',
        contentFilters: [
          { field: 'path', operator: 'LIKE', value: '/getting-started%' }
        ]
      },
      {
        title: 'Usage',
        contentCollection: 'docs',
        contentFilters: [
          { field: 'path', operator: 'LIKE', value: '/usage%' }
        ]
      },
      {
        title: 'Composables',
        contentCollection: 'docs',
        contentFilters: [
          { field: 'path', operator: 'LIKE', value: '/composables%' }
        ]
      },
      {
        title: 'Middleware',
        contentCollection: 'docs',
        contentFilters: [
          { field: 'path', operator: 'LIKE', value: '/middleware%' }
        ]
      },
      {
        title: 'Hooks',
        contentCollection: 'docs',
        contentFilters: [
          { field: 'path', operator: 'LIKE', value: '/hooks%' }
        ]
      },
      {
        title: 'Advanced',
        contentCollection: 'docs',
        contentFilters: [
          { field: 'path', operator: 'LIKE', value: '/advanced%' }
        ]
      }
    ]
  }
})


================================================
FILE: docs/package.json
================================================
{
  "name": "nuxt-auth-sanctum-docs",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "generate": "nuxt generate",
    "dev": "nuxt dev",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare",
    "lint": "eslint .",
    "lint:fix": "eslint . --fix",
    "upgrade": "pnpm self-update && npx nuxt upgrade --dedupe && pnpm up && pnpm lint"
  },
  "dependencies": {
    "@iconify-json/lucide": "^1.2.103",
    "@iconify-json/simple-icons": "^1.2.79",
    "@iconify-json/vscode-icons": "^1.2.46",
    "@nuxt/content": "^3.13.0",
    "@nuxt/image": "^1.11.0",
    "@nuxt/ui": "^4.7.0",
    "better-sqlite3": "^12.9.0",
    "nuxt": "^4.4.2",
    "nuxt-llms": "0.1.3",
    "nuxt-og-image": "^6.4.8"
  },
  "devDependencies": {
    "@nuxt/eslint": "^1.15.2",
    "@takumi-rs/core": "^0.73.1",
    "eslint": "^10.2.1",
    "typescript": "^5.9.3",
    "vue-tsc": "^3.2.7"
  },
  "resolutions": {
    "unimport": "4.1.1"
  },
  "packageManager": "pnpm@10.33.0"
}


================================================
FILE: docs/pnpm-workspace.yaml
================================================
ignoredBuiltDependencies:
  - "@parcel/watcher"
  - "@tailwindcss/oxide"
  - esbuild
  - unrs-resolver
  - vue-demi
onlyBuiltDependencies:
  - better-sqlite3
  - sharp


================================================
FILE: docs/renovate.json
================================================
{
  "extends": ["github>nuxt/renovate-config-nuxt"],
  "lockFileMaintenance": {
    "enabled": true
  },
  "packageRules": [
    {
      "matchDepTypes": ["resolutions"],
      "enabled": false
    }
  ],
  "postUpdateOptions": ["pnpmDedupe"]
}


================================================
FILE: docs/tsconfig.json
================================================
{
  "files": [],
  "references": [
    { "path": "./.nuxt/tsconfig.app.json" },
    { "path": "./.nuxt/tsconfig.server.json" },
    { "path": "./.nuxt/tsconfig.shared.json" },
    { "path": "./.nuxt/tsconfig.node.json" }
  ]
}


================================================
FILE: eslint.config.mjs
================================================
// @ts-check
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'

export default createConfigForNuxt(
  {
    features: {
      tooling: true,
      stylistic: true,
    },
    dirs: {
      src: ['./playground'],
    },
  },
  //
  {
    rules: {
      'vue/no-multiple-template-root': 'off',
      'vue/multi-word-component-names': 'off',
      '@stylistic/eol-last': 'off',
    },
  },
  //
  {
    ignores: ['docs/'],
  },
)


================================================
FILE: package.json
================================================
{
  "name": "nuxt-auth-sanctum",
  "version": "2.3.4",
  "author": {
    "name": "Artem Manchenkov",
    "email": "artem@manchenkoff.me",
    "url": "https://github.com/manchenkoff"
  },
  "description": "Nuxt module for Laravel Sanctum authentication",
  "homepage": "https://sanctum.manchenkoff.me",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/manchenkoff/nuxt-auth-sanctum.git"
  },
  "license": "MIT",
  "type": "module",
  "exports": {
    ".": {
      "types": "./dist/types.d.mts",
      "import": "./dist/module.mjs"
    }
  },
  "main": "./dist/module.mjs",
  "files": [
    "dist"
  ],
  "scripts": {
    "prepack": "nuxt-module-build build",
    "rc": "pnpm pack --pack-destination dist",
    "dev": "nuxi dev playground",
    "dev:build": "nuxi build playground",
    "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
    "lint": "eslint .",
    "lint:fix": "eslint . --fix",
    "test": "vitest run",
    "test:watch": "vitest watch",
    "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
    "validate": "npm run lint && npm run test:types && npm run test",
    "release": "npm run validate && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
    "upgrade": "pnpm self-update && npx nuxt upgrade --dedupe && pnpm up && pnpm dev:prepare && pnpm validate"
  },
  "dependencies": {
    "defu": "^6.1.7",
    "ofetch": "^1.5.1",
    "pathe": "^2.0.3"
  },
  "devDependencies": {
    "@nuxt/devtools": "^3.2.4",
    "@nuxt/eslint-config": "^1.15.2",
    "@nuxt/kit": "^4.4.2",
    "@nuxt/module-builder": "^1.0.2",
    "@nuxt/schema": "^4.4.2",
    "@nuxt/test-utils": "^4.0.2",
    "@types/node": "^25.6.0",
    "changelogen": "^0.6.2",
    "consola": "^3.4.2",
    "eslint": "^10.2.1",
    "h3": "1.15.11",
    "nuxt": "^4.4.2",
    "typescript": "^5.9.3",
    "vitest": "^4.1.5",
    "vue": "^3.5.33",
    "vue-tsc": "^3.2.7"
  },
  "packageManager": "pnpm@10.32.1",
  "pnpm": {
    "onlyBuiltDependencies": [
      "@parcel/watcher",
      "esbuild",
      "unrs-resolver"
    ]
  }
}


================================================
FILE: playground/app/app.vue
================================================
<template>
  <NuxtLayout>
    <NuxtPage />
  </NuxtLayout>
</template>


================================================
FILE: playground/app/error.vue
================================================
<script setup lang="ts">
import { useSanctumAuth } from '#imports'

interface ErrorProps {
  error?: {
    url: string
    statusCode: number
    statusMessage: string
    message: string
    description: string
    data?: unknown
  }
}

const props = defineProps<ErrorProps>()

const { isAuthenticated, logout } = useSanctumAuth()
</script>

<template>
  <NuxtLoadingIndicator />

  <h1>Nuxt - Laravel Sanctum application sample</h1>

  <nav class="menu">
    <NuxtLink to="/">
      Home
    </NuxtLink>
    <NuxtLink to="/login">
      Login
    </NuxtLink>
    <NuxtLink to="/logout">
      Logout
    </NuxtLink>
    <NuxtLink to="/profile">
      Profile
    </NuxtLink>
    <NuxtLink to="/welcome">
      Welcome
    </NuxtLink>

    <button
      v-if="isAuthenticated"
      @click="() => logout()"
    >
      Logout
    </button>
  </nav>

  <hr>

  <strong>Error</strong>
  <p>{{ props.error }}</p>
</template>

<style scoped>
.menu {
    display: flex;
    gap: 1rem;
}
</style>


================================================
FILE: playground/app/layouts/default.vue
================================================
<script lang="ts" setup>
import { useSanctumAuth } from '#imports'

const { isAuthenticated, logout } = useSanctumAuth()
</script>

<template>
  <NuxtLoadingIndicator />

  <h1>Nuxt - Laravel Sanctum application sample</h1>

  <nav class="menu">
    <NuxtLink to="/">
      Home
    </NuxtLink>
    <NuxtLink to="/login">
      Login
    </NuxtLink>
    <NuxtLink to="/logout">
      Logout
    </NuxtLink>
    <NuxtLink to="/profile">
      Profile
    </NuxtLink>
    <NuxtLink to="/welcome">
      Welcome
    </NuxtLink>

    <button
      v-if="isAuthenticated"
      @click="() => logout()"
    >
      Logout
    </button>
  </nav>

  <hr>
  <slot />
</template>

<style scoped>
.menu {
    display: flex;
    gap: 1rem;
}
</style>


================================================
FILE: playground/app/pages/index.vue
================================================
<script lang="ts" setup>
//
</script>

<template>
  <p>
    Welcome to demo application for Nuxt & Laravel Sanctum integration! Feel
    free to use navigation menu to check pages' behavior
  </p>
</template>


================================================
FILE: playground/app/pages/login.vue
================================================
<script lang="ts" setup>
import {
  definePageMeta,
  reactive,
  ref,
  useRoute,
  useSanctumAuth,
} from '#imports'

definePageMeta({
  middleware: ['sanctum:guest'],
})

const { login } = useSanctumAuth()
const route = useRoute()

const credentials = reactive({
  email: '',
  password: '',
  remember: false,
})

const loginError = ref('')

async function onFormSubmit() {
  try {
    await login(credentials)
  }
  catch (error) {
    loginError.value = error as string
  }
}
</script>

<template>
  <div v-if="route.query.redirect">
    Hmmm, looks like you tried to open
    <em>"{{ route.query.redirect }}"</em> page, login first to access it and
    we can redirect you there
  </div>

  <h2>Login form</h2>

  <p
    v-if="loginError"
    class="error-message"
  >
    Error - {{ loginError }}
  </p>

  <form
    class="login-form"
    @submit.prevent="onFormSubmit"
  >
    <div class="input-group">
      <label for="email">User email</label>
      <input
        id="email"
        v-model="credentials.email"
        autocomplete="username"
        type="text"
        name="email"
      >
    </div>

    <div class="input-group">
      <label for="password">Password</label>
      <input
        id="password"
        v-model="credentials.password"
        type="password"
        autocomplete="current-password"
        name="password"
      >
    </div>

    <div class="input-group">
      <label for="remember">Remember me</label>
      <input
        id="remember"
        v-model="credentials.remember"
        type="checkbox"
        name="remember"
      >
    </div>

    <button type="submit">
      Log in
    </button>
  </form>
</template>

<style scoped>
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: fit-content;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.error-message {
    color: red;
}
</style>


================================================
FILE: playground/app/pages/logout.vue
================================================
<script lang="ts" setup>
import { definePageMeta } from '#imports'

definePageMeta({
  middleware: ['sanctum:guest'],
})
</script>

<template>
  <p>Thanks for checking out this demo app! See you later :)</p>
</template>


================================================
FILE: playground/app/pages/profile.vue
================================================
<script lang="ts" setup>
import { definePageMeta, useSanctumAuth } from '#imports'

definePageMeta({
  middleware: ['sanctum:auth'],
})

const { isAuthenticated, user, refreshIdentity } = useSanctumAuth()
</script>

<template>
  <p>Your authentication status - {{ isAuthenticated }}</p>
  <p>Identity object - {{ user }}</p>
  <div>
    <button @click="refreshIdentity">
      Refetch user
    </button>
  </div>
</template>


================================================
FILE: playground/app/pages/welcome.vue
================================================
<script lang="ts" setup>
import { definePageMeta } from '#imports'

definePageMeta({
  middleware: ['sanctum:auth'],
})
</script>

<template>
  <p>Welcome, now you can access pages you had no access before... Try it!</p>
</template>


================================================
FILE: playground/app/plugins/sanctum.hooks.ts
================================================
export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook('sanctum:error:response', (response) => {
    console.log('Sanctum error hook triggered', response)
  })

  nuxtApp.hook('sanctum:error:request', (context) => {
    console.log('Sanctum request error hook triggered', context)
  })

  nuxtApp.hook('sanctum:request', (_nuxtApp, context, logger) => {
    logger.info('Sanctum request hook triggered', context.request)
  })

  nuxtApp.hook('sanctum:response', (_nuxtApp, context, logger) => {
    logger.info('Sanctum response hook triggered', context.request)
  })

  nuxtApp.hook('sanctum:redirect', (url) => {
    console.log('Sanctum redirect hook triggered', url)
  })

  nuxtApp.hook('sanctum:init', () => {
    console.log('Sanctum init hook triggered')
  })

  nuxtApp.hook('sanctum:refresh', () => {
    console.log('Sanctum refresh hook triggered')
  })

  nuxtApp.hook('sanctum:login', () => {
    console.log('Sanctum login hook triggered')
  })

  nuxtApp.hook('sanctum:logout', () => {
    console.log('Sanctum logout hook triggered')
  })
})


================================================
FILE: playground/app/plugins/sanctum.storage.client.ts
================================================
import type { NuxtApp } from '#app'
import type { TokenStorage } from '../../../src/runtime/types/config'

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook('sanctum:storage:token', () => {
    const tokenStorageKey = 'sanctum.storage.token'

    const localTokenStorage: TokenStorage = {
      get: async () => {
        if (import.meta.server) {
          return undefined
        }

        return window.localStorage.getItem(tokenStorageKey) ?? undefined
      },

      set: async (_app: NuxtApp, token?: string) => {
        if (import.meta.server) {
          return
        }

        if (!token) {
          window.localStorage.removeItem(tokenStorageKey)
          return
        }

        window.localStorage.setItem(tokenStorageKey, token)
      },
    }

    useSanctumTokenStorage(localTokenStorage)
  })
})


================================================
FILE: playground/nuxt.config.ts
================================================
export default defineNuxtConfig({
  modules: ['../src/module'],
  ssr: true,
  devtools: { enabled: true },
  future: {
    compatibilityVersion: 4,
  },
  sanctum: {
    baseUrl: '/api/sanctum',
    mode: 'cookie',
    logLevel: 4,
    redirect: {
      keepRequestedRoute: true,
      onAuthOnly: '/logi
Download .txt
gitextract_4wmesn7w/

├── .github/
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug.yml
│   │   ├── config.yml
│   │   └── feature.yml
│   ├── dependabot.yml
│   ├── pull_request_template.md
│   └── workflows/
│       ├── docs.yml
│       ├── prerelease.yml
│       ├── publish.yml
│       ├── upgrade.yml
│       └── validation.yml
├── .gitignore
├── .nuxtrc
├── .yamlfmt.yaml
├── .yamllint.yaml
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── TROUBLESHOOTING.md
├── docs/
│   ├── .env.example
│   ├── .gitignore
│   ├── .npmrc
│   ├── README.md
│   ├── app/
│   │   ├── app.config.ts
│   │   ├── app.vue
│   │   ├── assets/
│   │   │   └── css/
│   │   │       └── main.css
│   │   ├── components/
│   │   │   ├── AppFooter.vue
│   │   │   ├── AppHeader.vue
│   │   │   ├── AppLogo.vue
│   │   │   ├── OgImage/
│   │   │   │   └── OgImageDocs.takumi.vue
│   │   │   └── content/
│   │   │       ├── HeroBackground.vue
│   │   │       └── StarsBackground.vue
│   │   ├── error.vue
│   │   ├── layouts/
│   │   │   └── docs.vue
│   │   └── pages/
│   │       ├── [...slug].vue
│   │       └── index.vue
│   ├── content/
│   │   ├── 1.getting-started/
│   │   │   ├── .navigation.yml
│   │   │   ├── 1.index.md
│   │   │   └── 2.installation.md
│   │   ├── 2.usage/
│   │   │   ├── 1.configuration.md
│   │   │   ├── 2.cookie.md
│   │   │   ├── 3.token.md
│   │   │   └── 4.proxy.md
│   │   ├── 3.composables/
│   │   │   ├── 1.useSanctumAuth.md
│   │   │   ├── 2.useSanctumUser.md
│   │   │   ├── 3.useSanctumClient.md
│   │   │   ├── 4.useSanctumFetch.md
│   │   │   ├── 5.useLazySanctumFetch.md
│   │   │   ├── 6.useSanctumConfig.md
│   │   │   └── 7.useSanctumAppConfig.md
│   │   ├── 4.middleware/
│   │   │   ├── 1.sanctum-auth.md
│   │   │   ├── 2.sanctum-guest.md
│   │   │   └── 3.global.md
│   │   ├── 5.hooks/
│   │   │   ├── 1.sanctum-request.md
│   │   │   ├── 10.sanctum-proxy-request.md
│   │   │   ├── 2.sanctum-response.md
│   │   │   ├── 3.sanctum-error-request.md
│   │   │   ├── 4.sanctum-error-response.md
│   │   │   ├── 5.sanctum-redirect.md
│   │   │   ├── 6.sanctum-init.md
│   │   │   ├── 7.sanctum-refresh.md
│   │   │   ├── 8.sanctum-login.md
│   │   │   └── 9.sanctum-logout.md
│   │   ├── 6.advanced/
│   │   │   ├── 1.interceptors.md
│   │   │   ├── 2.error-handling.md
│   │   │   ├── 3.logging.md
│   │   │   ├── 4.token-storage.md
│   │   │   ├── 5.dependencies.md
│   │   │   ├── 6.breeze-nuxt-template.md
│   │   │   └── 7.troubleshooting.md
│   │   └── index.md
│   ├── content.config.ts
│   ├── eslint.config.mjs
│   ├── nuxt.config.ts
│   ├── package.json
│   ├── pnpm-workspace.yaml
│   ├── renovate.json
│   └── tsconfig.json
├── eslint.config.mjs
├── package.json
├── playground/
│   ├── app/
│   │   ├── app.vue
│   │   ├── error.vue
│   │   ├── layouts/
│   │   │   └── default.vue
│   │   ├── pages/
│   │   │   ├── index.vue
│   │   │   ├── login.vue
│   │   │   ├── logout.vue
│   │   │   ├── profile.vue
│   │   │   └── welcome.vue
│   │   └── plugins/
│   │       ├── sanctum.hooks.ts
│   │       └── sanctum.storage.client.ts
│   ├── nuxt.config.ts
│   ├── package.json
│   ├── pnpm-workspace.yaml
│   ├── server/
│   │   ├── plugins/
│   │   │   └── sanctum.hooks.ts
│   │   └── tsconfig.json
│   └── tsconfig.json
├── src/
│   ├── config.ts
│   ├── module.ts
│   ├── runtime/
│   │   ├── composables/
│   │   │   ├── useLazySanctumFetch.ts
│   │   │   ├── useSanctumAppConfig.ts
│   │   │   ├── useSanctumAuth.ts
│   │   │   ├── useSanctumClient.ts
│   │   │   ├── useSanctumConfig.ts
│   │   │   ├── useSanctumFetch.ts
│   │   │   ├── useSanctumTokenStorage.ts
│   │   │   └── useSanctumUser.ts
│   │   ├── httpFactory.ts
│   │   ├── interceptors/
│   │   │   ├── index.ts
│   │   │   ├── request/
│   │   │   │   ├── logging.ts
│   │   │   │   ├── params.ts
│   │   │   │   ├── stateful.ts
│   │   │   │   └── token.ts
│   │   │   └── response/
│   │   │       ├── errorHandler.ts
│   │   │       ├── logging.ts
│   │   │       ├── proxy.ts
│   │   │       └── validation.ts
│   │   ├── middleware/
│   │   │   ├── sanctum.auth.ts
│   │   │   ├── sanctum.global.ts
│   │   │   └── sanctum.guest.ts
│   │   ├── plugin.ts
│   │   ├── server/
│   │   │   ├── api/
│   │   │   │   └── proxy.ts
│   │   │   └── augments.server.d.ts
│   │   ├── storages/
│   │   │   └── cookieTokenStorage.ts
│   │   ├── types/
│   │   │   ├── config.ts
│   │   │   ├── fetch.ts
│   │   │   ├── meta.ts
│   │   │   └── options.ts
│   │   └── utils/
│   │       ├── constants.ts
│   │       ├── credentials.ts
│   │       ├── formatter.ts
│   │       ├── logging.ts
│   │       ├── runtime.ts
│   │       └── session.ts
│   └── templates.ts
├── test/
│   ├── helpers/
│   │   ├── constants.ts
│   │   └── mocks.ts
│   └── unit/
│       ├── config.test.ts
│       ├── constants.test.ts
│       ├── credentials.test.ts
│       ├── formatter.test.ts
│       ├── interceptors/
│       │   ├── request/
│       │   │   ├── logging.test.ts
│       │   │   ├── params.test.ts
│       │   │   ├── stateful.test.ts
│       │   │   └── token.test.ts
│       │   └── response/
│       │       ├── errorHandler.test.ts
│       │       ├── logging.test.ts
│       │       ├── proxy.test.ts
│       │       └── validation.test.ts
│       ├── logging.test.ts
│       └── runtime.test.ts
├── tsconfig.json
└── vitest.config.ts
Download .txt
SYMBOL INDEX (76 symbols across 28 files)

FILE: src/module.ts
  constant MODULE_NAME (line 15) | const MODULE_NAME = 'nuxt-auth-sanctum'
  type ModuleRuntimeConfig (line 17) | type ModuleRuntimeConfig = { sanctum: Partial<ModuleOptions> }
  type ModulePublicRuntimeConfig (line 18) | type ModulePublicRuntimeConfig = { sanctum: Partial<PublicModuleOptions> }
  method setup (line 28) | setup(_options, _nuxt) {

FILE: src/runtime/composables/useLazySanctumFetch.ts
  function useLazySanctumFetch (line 6) | function useLazySanctumFetch<T>(

FILE: src/runtime/composables/useSanctumAuth.ts
  type SanctumAuth (line 11) | interface SanctumAuth<T> {
  type TokenResponse (line 20) | type TokenResponse = {
  function init (line 50) | async function init() {
  function refreshIdentity (line 64) | async function refreshIdentity() {
  function login (line 76) | async function login(credentials: Record<string, unknown>, fetchIdentity...
  function logout (line 168) | async function logout(options: SanctumFetchOptions = {}): Promise<void> {

FILE: src/runtime/composables/useSanctumFetch.ts
  function useSanctumFetch (line 6) | function useSanctumFetch<T>(

FILE: src/runtime/httpFactory.ts
  function useClientInterceptors (line 13) | function useClientInterceptors(): [
  function createHttpClient (line 33) | function createHttpClient(nuxtApp: NuxtApp, logger: ConsolaInstance): Sa...

FILE: src/runtime/interceptors/request/logging.ts
  function logRequestHeaders (line 11) | async function logRequestHeaders(

FILE: src/runtime/interceptors/request/params.ts
  constant ACCEPT_HEADER (line 5) | const ACCEPT_HEADER = 'Accept'
  function setRequestParams (line 13) | async function setRequestParams(

FILE: src/runtime/interceptors/request/stateful.ts
  constant SECURE_METHODS (line 8) | const SECURE_METHODS = new Set(['post', 'delete', 'put', 'patch'])
  constant COOKIE_OPTIONS (line 9) | const COOKIE_OPTIONS: { readonly: true, watch: false } = { readonly: tru...
  function useClientHeaders (line 17) | function useClientHeaders(
  function initCsrfCookie (line 47) | async function initCsrfCookie(
  function useCsrfHeader (line 69) | async function useCsrfHeader(
  function setStatefulParams (line 105) | async function setStatefulParams(

FILE: src/runtime/interceptors/request/token.ts
  constant AUTHORIZATION_HEADER (line 7) | const AUTHORIZATION_HEADER = 'Authorization'
  function setTokenHeader (line 15) | async function setTokenHeader(

FILE: src/runtime/interceptors/response/errorHandler.ts
  function handleResponseError (line 16) | async function handleResponseError(

FILE: src/runtime/interceptors/response/logging.ts
  function logResponseHeaders (line 11) | async function logResponseHeaders(

FILE: src/runtime/interceptors/response/proxy.ts
  function appendServerResponseHeaders (line 19) | function appendServerResponseHeaders(
  function extractCookiesFromEventHeaders (line 50) | function extractCookiesFromEventHeaders(headers: OutgoingHttpHeaders): s...
  function extractCookiesFromResponse (line 65) | function extractCookiesFromResponse(ctx: FetchContext, logger: ConsolaIn...
  function createCookiesMap (line 80) | function createCookiesMap(...cookieCollections: string[][]) {
  function writeCookiesToEventResponse (line 104) | function writeCookiesToEventResponse(event: H3Event, headers: OutgoingHt...
  function proxyResponseHeaders (line 119) | async function proxyResponseHeaders(

FILE: src/runtime/interceptors/response/validation.ts
  type HeaderValidator (line 9) | type HeaderValidator = (headers: Headers, config: PublicModuleOptions, l...
  function validateResponseHeaders (line 108) | async function validateResponseHeaders(

FILE: src/runtime/plugin.ts
  function resolveTokenStorage (line 16) | async function resolveTokenStorage(nuxtApp: NuxtApp, logger: ConsolaInst...
  function initialIdentityLoad (line 37) | async function initialIdentityLoad(nuxtApp: NuxtApp, client: $Fetch, opt...
  method setup (line 94) | async setup(_nuxtApp) {

FILE: src/runtime/server/api/proxy.ts
  constant METHODS_WITH_BODY (line 22) | const METHODS_WITH_BODY: HTTPMethod[] = ['POST', 'PUT', 'PATCH', 'DELETE']
  constant REQUEST_HEADERS_TO_IGNORE (line 24) | const REQUEST_HEADERS_TO_IGNORE = [
  constant RESPONSE_HEADERS_TO_IGNORE (line 38) | const RESPONSE_HEADERS_TO_IGNORE = [
  function assembleEndpoint (line 60) | function assembleEndpoint(event: H3Event<EventHandlerRequest>, baseUrl: ...
  function dropProxyHeaders (line 76) | function dropProxyHeaders(headers: RequestHeaders): RequestHeaders {
  function proxyRequest (line 84) | async function proxyRequest(event: H3Event<EventHandlerRequest>, endpoin...
  function getBody (line 109) | async function getBody(event: H3Event<EventHandlerRequest>) {
  function prepareResponse (line 129) | function prepareResponse(event: H3Event<EventHandlerRequest>, response: ...

FILE: src/runtime/server/augments.server.d.ts
  type NitroRuntimeHooks (line 2) | interface NitroRuntimeHooks {

FILE: src/runtime/storages/cookieTokenStorage.ts
  method get (line 13) | async get(app: NuxtApp) {
  method set (line 20) | async set(app: NuxtApp, token?: string) {

FILE: src/runtime/types/config.ts
  type TokenStorage (line 8) | interface TokenStorage {
  type SanctumInterceptor (line 22) | type SanctumInterceptor = (
  type SanctumAppConfig (line 31) | interface SanctumAppConfig {

FILE: src/runtime/types/fetch.ts
  type SanctumFetchOptions (line 4) | type SanctumFetchOptions<R extends ResponseType = ResponseType, T = unkn...
  type SanctumFetch (line 16) | interface SanctumFetch extends $Fetch {
  type SanctumFetchResponse (line 22) | type SanctumFetchResponse<T> = AsyncData<PickFrom<T, KeysOf<T>> | undefi...

FILE: src/runtime/types/meta.ts
  type SanctumGlobalMiddlewarePageMeta (line 4) | interface SanctumGlobalMiddlewarePageMeta {

FILE: src/runtime/types/options.ts
  type SanctumEndpoints (line 4) | interface SanctumEndpoints {
  type CsrfOptions (line 30) | interface CsrfOptions {
  type ClientOptions (line 46) | interface ClientOptions {
  type RedirectOptions (line 62) | interface RedirectOptions {
  type GlobalMiddlewareOptions (line 97) | interface GlobalMiddlewareOptions {
  type ServerProxy (line 118) | interface ServerProxy {
  type PublicModuleOptions (line 140) | interface PublicModuleOptions {
  type ModuleOptions (line 214) | interface ModuleOptions extends PublicModuleOptions {

FILE: src/runtime/utils/constants.ts
  constant IDENTITY_LOADED_KEY (line 1) | const IDENTITY_LOADED_KEY = 'sanctum.user.loaded'

FILE: src/runtime/utils/credentials.ts
  function determineCredentialsMode (line 4) | function determineCredentialsMode() {

FILE: src/runtime/utils/formatter.ts
  function trimTrailingSlash (line 5) | function trimTrailingSlash(path: string): string {

FILE: src/runtime/utils/logging.ts
  constant LOGGER_NAME (line 4) | const LOGGER_NAME = 'nuxt-auth-sanctum'
  function useSanctumLogger (line 6) | function useSanctumLogger(logLevel: number, server: boolean): ConsolaIns...

FILE: src/runtime/utils/session.ts
  function isUserSessionActive (line 12) | async function isUserSessionActive(): Promise<boolean> {

FILE: test/helpers/constants.ts
  constant TEST_CONFIG (line 1) | const TEST_CONFIG = {
  constant HTTP_METHODS_REQUIRING_CSRF (line 14) | const HTTP_METHODS_REQUIRING_CSRF = ['POST', 'PUT', 'PATCH', 'DELETE']
  constant COMMON_HEADERS (line 16) | const COMMON_HEADERS = {

FILE: test/helpers/mocks.ts
  function createMock (line 5) | function createMock<T>(mock: object = {}): T {
  function createAppMock (line 9) | function createAppMock(mock: object = {}): NuxtApp {
  function createLoggerMock (line 19) | function createLoggerMock(mock: object = {}): ConsolaInstance {
Condensed preview — 155 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (325K chars).
[
  {
    "path": ".github/FUNDING.yml",
    "chars": 105,
    "preview": "github: manchenkoff\nthanks_dev: manchenkoff\nbuy_me_a_coffee: manchenkoff\ntidelift: npm/nuxt-auth-sanctum\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug.yml",
    "chars": 2847,
    "preview": "name: Bug Report\ndescription: Report a bug or incorrect behaviour\ntitle: \"[bug] name\"\nlabels: bug\nassignees: manchenkoff"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "chars": 28,
    "preview": "blank_issues_enabled: false\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature.yml",
    "chars": 1188,
    "preview": "name: Feature Request\ndescription: Suggest an idea for this project\ntitle: \"[feature] name\"\nlabels: enhancement\nassignee"
  },
  {
    "path": ".github/dependabot.yml",
    "chars": 108,
    "preview": "version: 2\nupdates:\n  - package-ecosystem: \"npm\"\n    directory: \"/\"\n    schedule:\n      interval: \"monthly\"\n"
  },
  {
    "path": ".github/pull_request_template.md",
    "chars": 88,
    "preview": "**Describe the problem and solution**\n\nCloses #XXX.\n\nREPLACE_THIS_WITH_YOUR_DESCRIPTION\n"
  },
  {
    "path": ".github/workflows/docs.yml",
    "chars": 1221,
    "preview": "name: Nuxt [Docs]\nenv:\n  node_version: 24\nconcurrency:\n  group: \"pages\"\n  cancel-in-progress: false\non:\n  push:\n    bran"
  },
  {
    "path": ".github/workflows/prerelease.yml",
    "chars": 1743,
    "preview": "name: Nuxt [Pre-Release]\nenv:\n  node_version: 24\n  node_registry: https://registry.npmjs.org/\n  changelog_user: Github C"
  },
  {
    "path": ".github/workflows/publish.yml",
    "chars": 1691,
    "preview": "name: Nuxt [Release]\nenv:\n  node_version: 24\n  node_registry: https://registry.npmjs.org/\n  changelog_user: Github CI\n  "
  },
  {
    "path": ".github/workflows/upgrade.yml",
    "chars": 2633,
    "preview": "name: Upgrade Dependencies\n\nenv:\n  node_version: 24\n  git_email: artem@manchenkoff.me\n  git_name: manchenkoff\n\non:\n  wor"
  },
  {
    "path": ".github/workflows/validation.yml",
    "chars": 1213,
    "preview": "name: Nuxt [Validate]\nenv:\n  node_version: 24\nconcurrency:\n  group: nuxt-auth-sanctum-ci\n  cancel-in-progress: false\non:"
  },
  {
    "path": ".gitignore",
    "chars": 542,
    "preview": "# Dependencies\nnode_modules\n\n# Logs\n*.log\n\n# Temp directories\n.temp\n.tmp\n.cache\n\n# Yarn\n**/.yarn/cache\n**/.yarn/*state*\n"
  },
  {
    "path": ".nuxtrc",
    "chars": 31,
    "preview": "setups.@nuxt/test-utils=\"4.0.2\""
  },
  {
    "path": ".yamlfmt.yaml",
    "chars": 123,
    "preview": "# https://github.com/google/yamlfmt/blob/main/docs/config-file.md\nformatter:\n  type: basic\n  include_document_start: fal"
  },
  {
    "path": ".yamllint.yaml",
    "chars": 132,
    "preview": "# https://yamllint.readthedocs.io/en/stable/rules.html\nextends: default\nrules:\n  document-start:\n    present: false\n  tr"
  },
  {
    "path": "CHANGELOG.md",
    "chars": 59627,
    "preview": "# Changelog\n\n\n## v2.3.4\n\n[compare changes](https://github.com/manchenkoff/nuxt-auth-sanctum/compare/v2.3.3...v2.3.4)\n\n##"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 5251,
    "preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participa"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 2520,
    "preview": "# How to contribute\n\nPlease follow the guidelines below if you want to contribute to the project.\n\nIf you are working on"
  },
  {
    "path": "LICENSE",
    "chars": 1073,
    "preview": "MIT License\n\nCopyright (c) 2023 Artem Manchenkov\n\nPermission is hereby granted, free of charge, to any person obtaining "
  },
  {
    "path": "README.md",
    "chars": 2744,
    "preview": "# Nuxt Auth Sanctum\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downl"
  },
  {
    "path": "SECURITY.md",
    "chars": 410,
    "preview": "# Security Policy\n\n## Supported Versions\n\n| Version  | Supported          |\n| -------- | ------------------ |\n| >= 0.3.0"
  },
  {
    "path": "TROUBLESHOOTING.md",
    "chars": 180,
    "preview": "# Troubleshooting Guide\n\nIf you experience any issues while using this module, please check this link - [Troubleshooting"
  },
  {
    "path": "docs/.env.example",
    "chars": 112,
    "preview": "# Public URL, used for OG Image when running nuxt generate\nNUXT_PUBLIC_SITE_URL=https://sanctum.manchenkoff.me\n\n"
  },
  {
    "path": "docs/.gitignore",
    "chars": 209,
    "preview": "# Nuxt dev/build outputs\n.output\n.data\n.nuxt\n.nitro\n.cache\ndist\n\n# Node dependencies\nnode_modules\n\n# Logs\nlogs\n*.log\n\n# "
  },
  {
    "path": "docs/.npmrc",
    "chars": 22,
    "preview": "shamefully-hoist=true\n"
  },
  {
    "path": "docs/README.md",
    "chars": 664,
    "preview": "# Nuxt - Laravel Sanctum Docs\n\nThis directory contains Nuxt Content project to deploy\nmodule documentation to Github Pag"
  },
  {
    "path": "docs/app/app.config.ts",
    "chars": 3850,
    "preview": "const siteName = 'Nuxt - Laravel Sanctum'\n\nexport default defineAppConfig({\n  ui: {\n    colors: {\n      primary: 'red',\n"
  },
  {
    "path": "docs/app/app.vue",
    "chars": 964,
    "preview": "<script setup lang=\"ts\">\nconst { seo } = useAppConfig()\n\nconst { data: navigation } = await useAsyncData('navigation', ("
  },
  {
    "path": "docs/app/assets/css/main.css",
    "chars": 215,
    "preview": "@import \"tailwindcss\";\n@import \"@nuxt/ui\";\n\n@source \"../../../content/**/*\";\n\n@theme static {\n  --container-8xl: 90rem;\n"
  },
  {
    "path": "docs/app/components/AppFooter.vue",
    "chars": 497,
    "preview": "<script setup lang=\"ts\">\nconst { footer } = useAppConfig()\n</script>\n\n<template>\n  <UFooter>\n    <template #left>\n      "
  },
  {
    "path": "docs/app/components/AppHeader.vue",
    "chars": 1007,
    "preview": "<script setup lang=\"ts\">\nimport type { ContentNavigationItem } from '@nuxt/content'\n\nconst navigation = inject<Ref<Conte"
  },
  {
    "path": "docs/app/components/AppLogo.vue",
    "chars": 421,
    "preview": "<script lang=\"ts\" setup>\nconst { header } = useAppConfig()\n</script>\n\n<template>\n  <div class=\"flex gap-2 items-center\">"
  },
  {
    "path": "docs/app/components/OgImage/OgImageDocs.takumi.vue",
    "chars": 2589,
    "preview": "<script lang=\"ts\" setup>\ninterface ComponentProps {\n  title?: string\n  description?: string\n  headline?: string\n}\n\nconst"
  },
  {
    "path": "docs/app/components/content/HeroBackground.vue",
    "chars": 2004,
    "preview": "<script setup lang=\"ts\">\nconst { isLoading } = useLoadingIndicator()\n\nconst appear = ref(false)\nconst appeared = ref(fal"
  },
  {
    "path": "docs/app/components/content/StarsBackground.vue",
    "chars": 4890,
    "preview": "<script setup lang=\"ts\">\ninterface ComponentProps {\n  starCount?: number\n  color?: string\n  speed?: 'slow' | 'normal' | "
  },
  {
    "path": "docs/app/error.vue",
    "chars": 807,
    "preview": "<script setup lang=\"ts\">\nimport type { NuxtError } from '#app'\n\ninterface ComponentProps {\n  error: NuxtError\n}\n\ndefineP"
  },
  {
    "path": "docs/app/layouts/docs.vue",
    "chars": 447,
    "preview": "<script setup lang=\"ts\">\nimport type { ContentNavigationItem } from '@nuxt/content'\n\nconst navigation = inject<Ref<Conte"
  },
  {
    "path": "docs/app/pages/[...slug].vue",
    "chars": 2731,
    "preview": "<script setup lang=\"ts\">\nimport type { ContentNavigationItem } from '@nuxt/content'\nimport { findPageHeadline } from '@n"
  },
  {
    "path": "docs/app/pages/index.vue",
    "chars": 670,
    "preview": "<script setup lang=\"ts\">\nconst { data: page } = await useAsyncData('index', () => queryCollection('landing').path('/').f"
  },
  {
    "path": "docs/content/1.getting-started/.navigation.yml",
    "chars": 35,
    "preview": "title: Getting Started\nicon: false\n"
  },
  {
    "path": "docs/content/1.getting-started/1.index.md",
    "chars": 2906,
    "preview": "---\ntitle: Introduction\ndescription: Welcome to Nuxt Laravel Sanctum module documentation\nnavigation:\n  icon: i-simple-i"
  },
  {
    "path": "docs/content/1.getting-started/2.installation.md",
    "chars": 1100,
    "preview": "---\ntitle: Installation\ndescription: How to add nuxt-auth-sanctum to your Nuxt application!\nnavigation:\n  icon: i-lucide"
  },
  {
    "path": "docs/content/2.usage/1.configuration.md",
    "chars": 8566,
    "preview": "---\ntitle: Configuration\ndescription: How to configure nuxt-auth-sanctum for Nuxt\nnavigation:\n  icon: i-lucide-cog\n---\n\n"
  },
  {
    "path": "docs/content/2.usage/2.cookie.md",
    "chars": 2285,
    "preview": "---\ntitle: Cookie Authentication\ndescription: Set up cookie CSRF authentication for Sanctum\nnavigation:\n  icon: i-lucide"
  },
  {
    "path": "docs/content/2.usage/3.token.md",
    "chars": 3240,
    "preview": "---\ntitle: Token Authentication\ndescription: Set up cookie Bearer token authentication for Sanctum\nnavigation:\n  icon: i"
  },
  {
    "path": "docs/content/2.usage/4.proxy.md",
    "chars": 1504,
    "preview": "---\ntitle: Server Proxy\ndescription: How to use your Nuxt app as a proxy for Sanctum API requests\nnavigation:\n  icon: i-"
  },
  {
    "path": "docs/content/3.composables/1.useSanctumAuth.md",
    "chars": 2353,
    "preview": "---\ntitle: useSanctumAuth\ndescription: How to use useSanctumAuth composable to work with state\nnavigation:\n  icon: i-luc"
  },
  {
    "path": "docs/content/3.composables/2.useSanctumUser.md",
    "chars": 580,
    "preview": "---\ntitle: useSanctumUser\ndescription: How to use useSanctumUser composable to work with authenticated user\nnavigation:\n"
  },
  {
    "path": "docs/content/3.composables/3.useSanctumClient.md",
    "chars": 850,
    "preview": "---\ntitle: useSanctumClient\ndescription: How to use useSanctumClient to work with preconfigured fetch client\nnavigation:"
  },
  {
    "path": "docs/content/3.composables/4.useSanctumFetch.md",
    "chars": 1126,
    "preview": "---\ntitle: useSanctumFetch\ndescription: How to use useSanctumFetch to fetch data from Laravel API\nnavigation:\n  icon: i-"
  },
  {
    "path": "docs/content/3.composables/5.useLazySanctumFetch.md",
    "chars": 1270,
    "preview": "---\ntitle: useLazySanctumFetch\ndescription: How to use useLazySanctumFetch to fetch data from Laravel API\nnavigation:\n  "
  },
  {
    "path": "docs/content/3.composables/6.useSanctumConfig.md",
    "chars": 990,
    "preview": "---\ntitle: useSanctumConfig\ndescription: How to use useSanctumConfig to retrieve module configuration\nnavigation:\n  icon"
  },
  {
    "path": "docs/content/3.composables/7.useSanctumAppConfig.md",
    "chars": 562,
    "preview": "---\ntitle: useSanctumAppConfig\ndescription: How to use useSanctumAppConfig to retrieve module application configuration\n"
  },
  {
    "path": "docs/content/4.middleware/1.sanctum-auth.md",
    "chars": 931,
    "preview": "---\ntitle: sanctum:auth\ndescription: How to protect pages from unauthenticated users\nnavigation:\n  icon: i-lucide-user-l"
  },
  {
    "path": "docs/content/4.middleware/2.sanctum-guest.md",
    "chars": 633,
    "preview": "---\ntitle: sanctum:guest\ndescription: How to protect pages from authenticated users\nnavigation:\n  icon: i-lucide-lock-op"
  },
  {
    "path": "docs/content/4.middleware/3.global.md",
    "chars": 3058,
    "preview": "---\ntitle: Global middleware\ndescription: How to configure global middleware for the whole Nuxt application\nnavigation:\n"
  },
  {
    "path": "docs/content/5.hooks/1.sanctum-request.md",
    "chars": 894,
    "preview": "---\ntitle: sanctum:request\ndescription: Subscribe to request hook to inject custom event handling\nnavigation:\n  icon: i-"
  },
  {
    "path": "docs/content/5.hooks/10.sanctum-proxy-request.md",
    "chars": 1040,
    "preview": "---\ntitle: sanctum:proxy:request\ndescription: Subscribe to request hook to inject custom event handling for proxy endpoi"
  },
  {
    "path": "docs/content/5.hooks/2.sanctum-response.md",
    "chars": 876,
    "preview": "---\ntitle: sanctum:response\ndescription: Subscribe to response hook to inject custom event handling\nnavigation:\n  icon: "
  },
  {
    "path": "docs/content/5.hooks/3.sanctum-error-request.md",
    "chars": 826,
    "preview": "---\ntitle: sanctum:error:request\ndescription: Subscribe to request error hook to inject custom event handling\nnavigation"
  },
  {
    "path": "docs/content/5.hooks/4.sanctum-error-response.md",
    "chars": 1116,
    "preview": "---\ntitle: sanctum:error:response\ndescription: Subscribe to response error hook to inject custom event handling\nnavigati"
  },
  {
    "path": "docs/content/5.hooks/5.sanctum-redirect.md",
    "chars": 852,
    "preview": "---\ntitle: sanctum:redirect\ndescription: Subscribe to redirect hook to inject custom event handling\nnavigation:\n  icon: "
  },
  {
    "path": "docs/content/5.hooks/6.sanctum-init.md",
    "chars": 1013,
    "preview": "---\ntitle: sanctum:init\ndescription: Subscribe to init hook to inject custom event handling\nnavigation:\n  icon: i-lucide"
  },
  {
    "path": "docs/content/5.hooks/7.sanctum-refresh.md",
    "chars": 752,
    "preview": "---\ntitle: sanctum:refresh\ndescription: Subscribe to refresh hook to inject custom event handling\nnavigation:\n  icon: i-"
  },
  {
    "path": "docs/content/5.hooks/8.sanctum-login.md",
    "chars": 645,
    "preview": "---\ntitle: sanctum:login\ndescription: Subscribe to login hook to inject custom event handling\nnavigation:\n  icon: i-luci"
  },
  {
    "path": "docs/content/5.hooks/9.sanctum-logout.md",
    "chars": 638,
    "preview": "---\ntitle: sanctum:logout\ndescription: Subscribe to logout hook to inject custom event handling\nnavigation:\n  icon: i-lu"
  },
  {
    "path": "docs/content/6.advanced/1.interceptors.md",
    "chars": 1737,
    "preview": "---\ntitle: Interceptors\ndescription: Use custom interceptors for the fetch client used for API calls\nnavigation:\n  icon:"
  },
  {
    "path": "docs/content/6.advanced/2.error-handling.md",
    "chars": 2641,
    "preview": "---\ntitle: Error handling\ndescription: How to catch Laravel API errors using this module\nnavigation:\n  icon: i-lucide-bu"
  },
  {
    "path": "docs/content/6.advanced/3.logging.md",
    "chars": 949,
    "preview": "---\ntitle: Logging\ndescription: How to extract useful debug information from the plugin\nnavigation:\n  icon: i-lucide-log"
  },
  {
    "path": "docs/content/6.advanced/4.token-storage.md",
    "chars": 4499,
    "preview": "---\ntitle: Token Storage\ndescription: How to work with storage with enabled token-based authentication\nnavigation:\n  ico"
  },
  {
    "path": "docs/content/6.advanced/5.dependencies.md",
    "chars": 2829,
    "preview": "---\ntitle: Plugin dependencies\ndescription: Configuration of plugin dependencies to control load order\nnavigation:\n  ico"
  },
  {
    "path": "docs/content/6.advanced/6.breeze-nuxt-template.md",
    "chars": 1087,
    "preview": "---\ntitle: Breeze Nuxt Template\ndescription: A quick introduction to the application template based on Nuxt for the Lara"
  },
  {
    "path": "docs/content/6.advanced/7.troubleshooting.md",
    "chars": 7791,
    "preview": "---\ntitle: Troubleshooting\ndescription: Follow this guide in case you are experiencing unexpected behaviour or facing so"
  },
  {
    "path": "docs/content/index.md",
    "chars": 3043,
    "preview": "---\nseo:\n  title: Nuxt - Laravel Sanctum\n  description: This module provides a simple way to use Laravel Sanctum with Nu"
  },
  {
    "path": "docs/content.config.ts",
    "chars": 568,
    "preview": "import { defineContentConfig, defineCollection, z } from '@nuxt/content'\n\nexport default defineContentConfig({\n  collect"
  },
  {
    "path": "docs/eslint.config.mjs",
    "chars": 120,
    "preview": "// @ts-check\nimport withNuxt from './.nuxt/eslint.config.mjs'\n\nexport default withNuxt(\n  // Your custom configs here\n)\n"
  },
  {
    "path": "docs/nuxt.config.ts",
    "chars": 2344,
    "preview": "export default defineNuxtConfig({\n  modules: [\n    '@nuxt/eslint',\n    '@nuxt/image',\n    '@nuxt/ui',\n    '@nuxt/content"
  },
  {
    "path": "docs/package.json",
    "chars": 1000,
    "preview": "{\n  \"name\": \"nuxt-auth-sanctum-docs\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"nuxt build\",\n "
  },
  {
    "path": "docs/pnpm-workspace.yaml",
    "chars": 168,
    "preview": "ignoredBuiltDependencies:\n  - \"@parcel/watcher\"\n  - \"@tailwindcss/oxide\"\n  - esbuild\n  - unrs-resolver\n  - vue-demi\nonly"
  },
  {
    "path": "docs/renovate.json",
    "chars": 245,
    "preview": "{\n  \"extends\": [\"github>nuxt/renovate-config-nuxt\"],\n  \"lockFileMaintenance\": {\n    \"enabled\": true\n  },\n  \"packageRules"
  },
  {
    "path": "docs/tsconfig.json",
    "chars": 227,
    "preview": "{\n  \"files\": [],\n  \"references\": [\n    { \"path\": \"./.nuxt/tsconfig.app.json\" },\n    { \"path\": \"./.nuxt/tsconfig.server.j"
  },
  {
    "path": "eslint.config.mjs",
    "chars": 440,
    "preview": "// @ts-check\nimport { createConfigForNuxt } from '@nuxt/eslint-config/flat'\n\nexport default createConfigForNuxt(\n  {\n   "
  },
  {
    "path": "package.json",
    "chars": 2137,
    "preview": "{\n  \"name\": \"nuxt-auth-sanctum\",\n  \"version\": \"2.3.4\",\n  \"author\": {\n    \"name\": \"Artem Manchenkov\",\n    \"email\": \"artem"
  },
  {
    "path": "playground/app/app.vue",
    "chars": 71,
    "preview": "<template>\n  <NuxtLayout>\n    <NuxtPage />\n  </NuxtLayout>\n</template>\n"
  },
  {
    "path": "playground/app/error.vue",
    "chars": 992,
    "preview": "<script setup lang=\"ts\">\nimport { useSanctumAuth } from '#imports'\n\ninterface ErrorProps {\n  error?: {\n    url: string\n "
  },
  {
    "path": "playground/app/layouts/default.vue",
    "chars": 739,
    "preview": "<script lang=\"ts\" setup>\nimport { useSanctumAuth } from '#imports'\n\nconst { isAuthenticated, logout } = useSanctumAuth()"
  },
  {
    "path": "playground/app/pages/index.vue",
    "chars": 209,
    "preview": "<script lang=\"ts\" setup>\n//\n</script>\n\n<template>\n  <p>\n    Welcome to demo application for Nuxt & Laravel Sanctum integ"
  },
  {
    "path": "playground/app/pages/login.vue",
    "chars": 1888,
    "preview": "<script lang=\"ts\" setup>\nimport {\n  definePageMeta,\n  reactive,\n  ref,\n  useRoute,\n  useSanctumAuth,\n} from '#imports'\n\n"
  },
  {
    "path": "playground/app/pages/logout.vue",
    "chars": 220,
    "preview": "<script lang=\"ts\" setup>\nimport { definePageMeta } from '#imports'\n\ndefinePageMeta({\n  middleware: ['sanctum:guest'],\n})"
  },
  {
    "path": "playground/app/pages/profile.vue",
    "chars": 425,
    "preview": "<script lang=\"ts\" setup>\nimport { definePageMeta, useSanctumAuth } from '#imports'\n\ndefinePageMeta({\n  middleware: ['san"
  },
  {
    "path": "playground/app/pages/welcome.vue",
    "chars": 233,
    "preview": "<script lang=\"ts\" setup>\nimport { definePageMeta } from '#imports'\n\ndefinePageMeta({\n  middleware: ['sanctum:auth'],\n})\n"
  },
  {
    "path": "playground/app/plugins/sanctum.hooks.ts",
    "chars": 1066,
    "preview": "export default defineNuxtPlugin((nuxtApp) => {\n  nuxtApp.hook('sanctum:error:response', (response) => {\n    console.log("
  },
  {
    "path": "playground/app/plugins/sanctum.storage.client.ts",
    "chars": 835,
    "preview": "import type { NuxtApp } from '#app'\nimport type { TokenStorage } from '../../../src/runtime/types/config'\n\nexport defaul"
  },
  {
    "path": "playground/nuxt.config.ts",
    "chars": 764,
    "preview": "export default defineNuxtConfig({\n  modules: ['../src/module'],\n  ssr: true,\n  devtools: { enabled: true },\n  future: {\n"
  },
  {
    "path": "playground/package.json",
    "chars": 332,
    "preview": "{\n  \"private\": true,\n  \"name\": \"nuxt-auth-sanctum-playground\",\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"nuxi dev\","
  },
  {
    "path": "playground/pnpm-workspace.yaml",
    "chars": 35,
    "preview": "onlyBuiltDependencies:\n  - esbuild\n"
  },
  {
    "path": "playground/server/plugins/sanctum.hooks.ts",
    "chars": 380,
    "preview": "import type { FetchContext } from 'ofetch'\nimport type { ConsolaInstance } from 'consola'\nimport type { NitroApp } from "
  },
  {
    "path": "playground/server/tsconfig.json",
    "chars": 51,
    "preview": "{\n    \"extends\": \"../.nuxt/tsconfig.server.json\"\n}\n"
  },
  {
    "path": "playground/tsconfig.json",
    "chars": 43,
    "preview": "{\n    \"extends\": \"./.nuxt/tsconfig.json\"\n}\n"
  },
  {
    "path": "src/config.ts",
    "chars": 907,
    "preview": "import type { ModuleOptions } from './runtime/types/options'\n\nexport const defaultModuleOptions: ModuleOptions = {\n  bas"
  },
  {
    "path": "src/module.ts",
    "chars": 2628,
    "preview": "import {\n  defineNuxtModule,\n  addPlugin,\n  createResolver,\n  addImportsDir,\n  addRouteMiddleware,\n  useLogger,\n  addSer"
  },
  {
    "path": "src/runtime/composables/useLazySanctumFetch.ts",
    "chars": 706,
    "preview": "import { type UseFetchOptions, useLazyFetch } from '#app'\nimport { toRaw, toValue, type MaybeRefOrGetter } from 'vue'\nim"
  },
  {
    "path": "src/runtime/composables/useSanctumAppConfig.ts",
    "chars": 220,
    "preview": "import type { SanctumAppConfig } from '../types/config'\nimport { useAppConfig } from '#imports'\n\nexport const useSanctum"
  },
  {
    "path": "src/runtime/composables/useSanctumAuth.ts",
    "chars": 6252,
    "preview": "import { type ComputedRef, type Ref, computed } from 'vue'\nimport { trimTrailingSlash } from '../utils/formatter'\nimport"
  },
  {
    "path": "src/runtime/composables/useSanctumClient.ts",
    "chars": 224,
    "preview": "import type { SanctumFetch } from '../types/fetch'\nimport { useNuxtApp } from '#app'\n\nexport const useSanctumClient = ()"
  },
  {
    "path": "src/runtime/composables/useSanctumConfig.ts",
    "chars": 416,
    "preview": "import type { PublicModuleOptions, ModuleOptions } from '../types/options'\nimport { useRuntimeConfig } from '#imports'\ni"
  },
  {
    "path": "src/runtime/composables/useSanctumFetch.ts",
    "chars": 680,
    "preview": "import { type UseFetchOptions, useFetch } from '#app'\nimport { toRaw, toValue, type MaybeRefOrGetter } from 'vue'\nimport"
  },
  {
    "path": "src/runtime/composables/useSanctumTokenStorage.ts",
    "chars": 243,
    "preview": "import type { TokenStorage } from '../types/config'\nimport { updateAppConfig } from '#app'\n\nexport const useSanctumToken"
  },
  {
    "path": "src/runtime/composables/useSanctumUser.ts",
    "chars": 380,
    "preview": "import type { Ref } from 'vue'\nimport { useSanctumConfig } from './useSanctumConfig'\nimport { useState } from '#app'\n\n/*"
  },
  {
    "path": "src/runtime/httpFactory.ts",
    "chars": 2608,
    "preview": "import type { FetchContext, FetchOptions } from 'ofetch'\nimport type { ConsolaInstance } from 'consola'\nimport { useSanc"
  },
  {
    "path": "src/runtime/interceptors/index.ts",
    "chars": 918,
    "preview": "import type { SanctumInterceptor } from '../types/config'\nimport { setRequestParams } from './request/params'\nimport { s"
  },
  {
    "path": "src/runtime/interceptors/request/logging.ts",
    "chars": 642,
    "preview": "import type { FetchContext } from 'ofetch'\nimport type { ConsolaInstance } from 'consola'\nimport type { NuxtApp } from '"
  },
  {
    "path": "src/runtime/interceptors/request/params.ts",
    "chars": 1000,
    "preview": "import type { FetchContext } from 'ofetch'\nimport type { ConsolaInstance } from 'consola'\nimport type { NuxtApp } from '"
  },
  {
    "path": "src/runtime/interceptors/request/stateful.ts",
    "chars": 3569,
    "preview": "import type { FetchContext } from 'ofetch'\nimport type { ConsolaInstance } from 'consola'\nimport { useSanctumConfig } fr"
  },
  {
    "path": "src/runtime/interceptors/request/token.ts",
    "chars": 1216,
    "preview": "import type { FetchContext } from 'ofetch'\nimport type { ConsolaInstance } from 'consola'\nimport { useSanctumAppConfig }"
  },
  {
    "path": "src/runtime/interceptors/response/errorHandler.ts",
    "chars": 1464,
    "preview": "import type { FetchContext, FetchResponse } from 'ofetch'\nimport type { ConsolaInstance } from 'consola'\nimport { useSan"
  },
  {
    "path": "src/runtime/interceptors/response/logging.ts",
    "chars": 598,
    "preview": "import type { FetchContext } from 'ofetch'\nimport type { ConsolaInstance } from 'consola'\nimport type { NuxtApp } from '"
  },
  {
    "path": "src/runtime/interceptors/response/proxy.ts",
    "chars": 4035,
    "preview": "import type { OutgoingHttpHeaders } from 'node:http'\nimport { getResponseHeaders, setResponseHeaders, splitCookiesString"
  },
  {
    "path": "src/runtime/interceptors/response/validation.ts",
    "chars": 3846,
    "preview": "import type { FetchContext } from 'ofetch'\nimport type { ConsolaInstance } from 'consola'\nimport type { PublicModuleOpti"
  },
  {
    "path": "src/runtime/middleware/sanctum.auth.ts",
    "chars": 925,
    "preview": "import type { RouteLocationAsPathGeneric } from 'vue-router'\nimport { useSanctumConfig } from '../composables/useSanctum"
  },
  {
    "path": "src/runtime/middleware/sanctum.global.ts",
    "chars": 1535,
    "preview": "import type { RouteLocationAsPathGeneric } from 'vue-router'\nimport { useSanctumConfig } from '../composables/useSanctum"
  },
  {
    "path": "src/runtime/middleware/sanctum.guest.ts",
    "chars": 670,
    "preview": "import { useSanctumAuth } from '../composables/useSanctumAuth'\nimport { useSanctumConfig } from '../composables/useSanct"
  },
  {
    "path": "src/runtime/plugin.ts",
    "chars": 3500,
    "preview": "import type { $Fetch } from 'ofetch'\nimport type { ConsolaInstance } from 'consola'\nimport type { NuxtApp } from '#app'\n"
  },
  {
    "path": "src/runtime/server/api/proxy.ts",
    "chars": 3881,
    "preview": "import type { EventHandlerRequest, H3Event, HTTPMethod, RequestHeaders } from 'h3'\nimport {\n  appendResponseHeader,\n  de"
  },
  {
    "path": "src/runtime/server/augments.server.d.ts",
    "chars": 218,
    "preview": "declare module 'nitropack/types' {\n  interface NitroRuntimeHooks {\n    /**\n     * Triggers on every proxy client request"
  },
  {
    "path": "src/runtime/storages/cookieTokenStorage.ts",
    "chars": 845,
    "preview": "import { unref } from 'vue'\nimport type { TokenStorage } from '../types/config'\nimport { useCookie, useRequestURL } from"
  },
  {
    "path": "src/runtime/types/config.ts",
    "chars": 822,
    "preview": "import type { FetchContext } from 'ofetch'\nimport type { ConsolaInstance } from 'consola'\nimport type { NuxtApp } from '"
  },
  {
    "path": "src/runtime/types/fetch.ts",
    "chars": 936,
    "preview": "import type { MappedResponseType, FetchRequest, Fetch, FetchOptions, FetchResponse, ResponseType, $Fetch, FetchError } f"
  },
  {
    "path": "src/runtime/types/meta.ts",
    "chars": 351,
    "preview": "/**\n * Page meta information to be used by the global middleware.\n */\nexport interface SanctumGlobalMiddlewarePageMeta {"
  },
  {
    "path": "src/runtime/types/options.ts",
    "chars": 5327,
    "preview": "/**\n * Definition of Laravel Sanctum endpoints to be used by the client.\n */\nexport interface SanctumEndpoints {\n  /**\n "
  },
  {
    "path": "src/runtime/utils/constants.ts",
    "chars": 57,
    "preview": "export const IDENTITY_LOADED_KEY = 'sanctum.user.loaded'\n"
  },
  {
    "path": "src/runtime/utils/credentials.ts",
    "chars": 348,
    "preview": "/**\n * Determines the credentials mode for the fetch request.\n */\nexport function determineCredentialsMode() {\n  // Fix "
  },
  {
    "path": "src/runtime/utils/formatter.ts",
    "chars": 251,
    "preview": "/**\n * Removes the trailing slash from a path if it exists.\n * @param path The URL path.\n */\nexport function trimTrailin"
  },
  {
    "path": "src/runtime/utils/logging.ts",
    "chars": 377,
    "preview": "import { createConsola } from 'consola'\nimport type { ConsolaInstance } from 'consola'\n\nconst LOGGER_NAME = 'nuxt-auth-s"
  },
  {
    "path": "src/runtime/utils/runtime.ts",
    "chars": 56,
    "preview": "export const isServerRuntime = () => import.meta.server\n"
  },
  {
    "path": "src/runtime/utils/session.ts",
    "chars": 1631,
    "preview": "import { useCookie, useNuxtApp } from '#app'\nimport { unref } from 'vue'\nimport { useSanctumLogger } from '../utils/logg"
  },
  {
    "path": "src/templates.ts",
    "chars": 2718,
    "preview": "import { addTypeTemplate } from '@nuxt/kit'\nimport type { Resolver } from '@nuxt/kit'\nimport { relative, resolve } from "
  },
  {
    "path": "test/helpers/constants.ts",
    "chars": 828,
    "preview": "export const TEST_CONFIG = {\n  BASE_URL: 'http://localhost:80',\n  CUSTOM_BASE_URL: 'http://remote-host.dev',\n  CUSTOM_OR"
  },
  {
    "path": "test/helpers/mocks.ts",
    "chars": 687,
    "preview": "import type { NuxtApp } from '#app'\nimport type { ConsolaInstance } from 'consola'\nimport { vi } from 'vitest'\n\nexport f"
  },
  {
    "path": "test/unit/config.test.ts",
    "chars": 2920,
    "preview": "import { describe, it, expect } from 'vitest'\nimport { defu } from 'defu'\nimport { defaultModuleOptions } from '../../sr"
  },
  {
    "path": "test/unit/constants.test.ts",
    "chars": 259,
    "preview": "import { describe, expect, it } from 'vitest'\nimport { IDENTITY_LOADED_KEY } from '../../src/runtime/utils/constants'\n\nd"
  },
  {
    "path": "test/unit/credentials.test.ts",
    "chars": 843,
    "preview": "import { describe, expect, it, beforeEach, afterEach } from 'vitest'\nimport { determineCredentialsMode } from '../../src"
  },
  {
    "path": "test/unit/formatter.test.ts",
    "chars": 741,
    "preview": "import { describe, expect, it } from 'vitest'\nimport { trimTrailingSlash } from '../../src/runtime/utils/formatter'\n\ndes"
  },
  {
    "path": "test/unit/interceptors/request/logging.test.ts",
    "chars": 1947,
    "preview": "import type { FetchContext } from 'ofetch'\nimport { describe, it, expect, vi, beforeEach } from 'vitest'\nimport { logReq"
  },
  {
    "path": "test/unit/interceptors/request/params.test.ts",
    "chars": 2689,
    "preview": "import { describe, it, expect, vi, beforeEach } from 'vitest'\nimport { setRequestParams } from '../../../../src/runtime/"
  },
  {
    "path": "test/unit/interceptors/request/stateful.test.ts",
    "chars": 12995,
    "preview": "import { beforeEach, describe, expect, it, vi } from 'vitest'\nimport { setStatefulParams } from '../../../../src/runtime"
  },
  {
    "path": "test/unit/interceptors/request/token.test.ts",
    "chars": 3511,
    "preview": "import { describe, it, expect, vi, beforeEach } from 'vitest'\nimport { setTokenHeader } from '../../../../src/runtime/in"
  },
  {
    "path": "test/unit/interceptors/response/errorHandler.test.ts",
    "chars": 4587,
    "preview": "import { describe, it, expect, vi, beforeEach } from 'vitest'\nimport { handleResponseError } from '../../../../src/runti"
  },
  {
    "path": "test/unit/interceptors/response/logging.test.ts",
    "chars": 1695,
    "preview": "import type { FetchContext } from 'ofetch'\nimport { describe, expect, it, vi, beforeEach } from 'vitest'\nimport { logRes"
  },
  {
    "path": "test/unit/interceptors/response/proxy.test.ts",
    "chars": 8699,
    "preview": "import { beforeEach, describe, expect, it, vi } from 'vitest'\nimport { proxyResponseHeaders } from '../../../../src/runt"
  },
  {
    "path": "test/unit/interceptors/response/validation.test.ts",
    "chars": 13163,
    "preview": "import { beforeEach, describe, expect, it, vi } from 'vitest'\nimport { validateResponseHeaders } from '../../../../src/r"
  },
  {
    "path": "test/unit/logging.test.ts",
    "chars": 1390,
    "preview": "import { describe, expect, it } from 'vitest'\nimport { useSanctumLogger } from '../../src/runtime/utils/logging'\n\ndescri"
  },
  {
    "path": "test/unit/runtime.test.ts",
    "chars": 335,
    "preview": "import { describe, expect, it } from 'vitest'\nimport { isServerRuntime } from '../../src/runtime/utils/runtime'\n\ndescrib"
  },
  {
    "path": "tsconfig.json",
    "chars": 120,
    "preview": "{\n  \"extends\": \"./.nuxt/tsconfig.json\",\n  \"exclude\": [\"dist\", \"node_modules\", \"playground\", \"docs\", \"test/fixtures\"]\n}\n\n"
  },
  {
    "path": "vitest.config.ts",
    "chars": 889,
    "preview": "import { defineConfig } from 'vitest/config'\nimport { defineVitestProject } from '@nuxt/test-utils/config'\n\nexport defau"
  }
]

About this extraction

This page contains the full source code of the manchenkoff/nuxt-auth-sanctum GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 155 files (296.5 KB), approximately 85.0k tokens, and a symbol index with 76 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!