Closed ILLuMiNaTe7 closed 2 months ago
Hey @ILLuMiNaTe7, thanks for the more detailed issue! I'll take a look and get back to you once I find something
Meanwhile, can you pls double-check that without slash at the end of allowed_origins
value 'https://app2.illuminate-solutions.nl/'
it also fails?
It should be like that
return [
'paths' => ['*'],
'allowed_methods' => ['*'],
'allowed_origins' => ['http://localhost:3000', 'https://app2.illuminate-solutions.nl'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => true,
];
Hi @manchenkoff I've updated it and tested it however the issue appears to persist.
I've also updated it on the test environment.
Do you happen to have a Laravel test repository so we can test if that works?
Nope, unfortunately, I don't have any preconfigured Laravel environment (will do it in the scope of #40). Right now only the Nuxt playground is available, you can clone this repo and start it locally by yarn dev
. Not sure that it would help, but at least you can confirm that it is the problem on Laravel's side 😄
Hey @ILLuMiNaTe7, I've just released v0.2.3 with additional logs for the plugin, if you still experience issues with connecting, you can try to upgrade and share the logs here to let me help with further investigation.
Regarding the fix, I couldn't reproduce the exact behavior thus I cannot tell what might be a reason in your case yet.
Closing this for now, feel free to re-open with new details!
@ILLuMiNaTe7, in Laravel use Session Driver to file
Describe the bug For some reason, I cannot manage to get the module to work with Laravel 11.
I've read the issue https://github.com/manchenkoff/nuxt-auth-sanctum/issues/34 however this one sadly did not lead to a solution for me.
Although the CSRF request and login functionalities are operational, accessing the
api/user
route triggers an authentication error within the app saying I am not authenticated.Temporarily I've opened up my test environment to the public so you can see the behaviour for yourself: https://app2.illuminate-solutions.nl/ (Nuxt 3) https://api2.illuminate-solutions.nl/ (Laravel 11)
To Reproduce Steps to reproduce the behavior:
When utilizing Breeze, there's an inherent POST request predefined for the /login route. However, even with the Default installation, this POST request must be manually initiated. For the sake of this demonstration, we'll be utilizing Breeze.
Expected behavior The user is signed in and being able to access the API.
Screenshots
Module information
sanctum
from yournuxt.config.ts
Nuxt environment:
Laravel environment:
Version: 11.0.0
Sanctum installed via Breeze +
php artisan install:api
Checklist completed: All checked.
Session domain from your
config/session.php
:SESSION_DOMAIN=.illuminate-solutions.nl
List of stateful domains from your
config/sanctum.php
Standard Laravel Breeze login handler
app/Http/Controllers/Auth/AuthenticatedSessionController.php
(Also doesn't work without Breeze).env configuration:
Api Routes configuration from
routes/api.php
CORS settings from your
config/cors.php
Additional context The issue might be caused by the missing
X-XSRF-TOKEN
in the/api/user
request during login attempts.