Troubleshooting

Follow this guide in case you are experiencing unexpected behaviour or facing some errors in the module work.

Expose Precognition headers for CORS

Since Laravel Precognition requires additional headers to be passed to the front-end application, make sure that you have configured exposed_headers in your config/cors.php on the Laravel side:

<?php

declare(strict_types=1);

return [
    'paths' => ['*'],
    'allowed_methods' => ['*'],
    'allowed_origins' => ['http://your-nuxt-app.dev'],
    'allowed_origins_patterns' => [],
    'allowed_headers' => ['*'],
    'exposed_headers' => ['Precognition', 'Precognition-Success'], // required
    'max_age' => 0,
    'supports_credentials' => true,
];

Other problems

If you experience any other problem related to the API requests, please refer to the official nuxt-auth-sanctum module documentation - Nuxt - Laravel Sanctum.

If nothing helps, feel free to raise an issue on the GitHub repository.

Last updated