artisan keeps crashing #174202
Unanswered
MahmoudGEA2005
asked this question in
Programming Help
artisan keeps crashing
#174202
Replies: 3 comments
-
Thanks for posting in the GitHub Community, @MahmoudGEA2005! We're happy you're here. You are more likely to get a useful response if you are posting your question in the applicable category, the Discussions category is solely related to conversations around the GitHub product Discussions. This question should be in the |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks,
…On Mon, Sep 22, 2025, 15:46 Code Atlas ***@***.***> wrote:
Thanks for posting in the GitHub Community, @MahmoudGEA2005
<https://github.com/MahmoudGEA2005>!
We're happy you're here. You are more likely to get a useful response if
you are posting your question in the applicable category, the Discussions
category is solely related to conversations around the GitHub product
Discussions
<https://docs.github.com/en/discussions/collaborating-with-your-community-using-discussions/about-discussions>.
This question should be in the Programming Help category. I've gone ahead
and moved it for you. Good luck!
—
Reply to this email directly, view it on GitHub
<#174202 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BNKQCX25EMBBHHO3IS3BTHL3T7VSXAVCNFSM6AAAAACHBTN65CVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINBXGYZTCOA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi MahmoudGEA2005, Why Artisan Stops After Switching to Sanctum
Possible cause for stopping can be (according to me)
May this can fix your problem
for sending credentials through reactaxios.get('/api/user', { withCredentials: true })
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Discussion Type
Product Feedback
Discussion Content
Laravel artisan server runs successfully with php artisan serve --port=8001 and if I make any request to any of the endpoints in api.php with postman it works, but when I make any request with my React front end, artisan stops in silence without leaving any log, this problem started when I moved to authentication with Sanctum Tokens, and I realized that
the problem happens after changing these files to sacntum.php
`
explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( '%s%s', 'localhost,localhost:3000,localhost:5175,127.0.0.1,127.0.0.1:8000,127.0.0.1:5175,::1', Sanctum::currentApplicationUrlWithPort(), ))), // 'guard' => ['web', 'admin', 'student'], // Keep all guards 'guard' => ['web'], // Keep all guards 'expiration' => 60 * 24 * 7, // Set token expiration to 7 days (in minutes) 'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''), 'middleware' => [ 'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class, 'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class, 'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class, ], ]; bootstrap/app.php ` ` withRouting( web: __DIR__.'/../routes/web.php', api: __DIR__.'/../routes/api.php', commands: __DIR__.'/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware) { // Prepend Sanctum middleware to the 'api' group $middleware->api(prepend: [ EnsureFrontendRequestsAreStateful::class, ]); // Add session and cookie middleware for stateful API $middleware->group('api', [ \Illuminate\Session\Middleware\StartSession::class, \Illuminate\Cookie\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, ]); }) ->withExceptions(function (Exceptions $exceptions) { // })->create(); ` auth.php ` ` [ 'guard' => env('AUTH_GUARD', 'web'), 'passwords' => env('AUTH_PASSWORD_BROKER', 'users'), ], 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'admin' => [ 'driver' => 'sanctum', // Changed from 'session' to 'sanctum' 'provider' => 'admin_users', ], 'student' => [ 'driver' => 'sanctum', // Changed from 'session' to 'sanctum' 'provider' => 'student_users', ] ], 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => env('AUTH_MODEL', App\Models\User::class), ], 'admin_users' => [ 'driver' => 'eloquent', 'model' => App\Models\AdminUser::class, ], 'student_users' => [ 'driver' => 'eloquent', 'model' => App\Models\StudentUser::class, ], ], 'passwords' => [ 'users' => [ 'provider' => 'users', 'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'), 'expire' => 60, 'throttle' => 60, ], ], 'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800), ]; ` I've been stuck with this Authentication for more than 2 days, any ideasBeta Was this translation helpful? Give feedback.
All reactions