Skip to main content

All Questions

7 votes
4 answers
12k views

Customize laravel sanctum unauthorize response

I am using laravel sanctum in my project, but I am facing a problem. I want to customize the 401 response code (unauthorized) to return a JSON when a token is invalid, something like this: { &...
5 votes
3 answers
2k views

Laravel sanctum csrf cookie set issue "attempt to set a cookie via a Set-Cookie header was blocked because its Domain attribute..."

I have an issue with the Laravel Sanctum CSRF Cookie's. I run an API with Laravel 8 on a subdomain: api.domain.nl And a front end with NuxtJS on domain.nl Now I want to protect my POST requests that ...
1 vote
0 answers
115 views

Request failed with status code 419 -Nextjs and Laravel Sanctum

I have two projects, Laravel 8 and Next.js. Everything works smoothly when I send a GET request, but I encounter an error when I send a POST request. I've attempted various solutions, but the issue ...
0 votes
1 answer
48 views

401 Unauthenticated error while using laravel sanctum

I'm using laravel framework version 8.54 and sanctum version 2.15 Creating apis Login and get User On local environment it works fine but on production it return 401 error Configurations Added ...
0 votes
0 answers
89 views

Laravel Sanctum Login And Register API with React js

I have a created my api in laravel using sanctum for user login and register and am getting this error xhr.js:258 POST http://jaano.test/api/login 419 (unknown status) settle.js:19 Uncaught (in ...
9 votes
8 answers
20k views

Laravel 8 Sanctum SPA Auth - Session store not set on request

I'm trying to implement Sanctum SPA Authentication. I'm getting the following error when trying to login (only in production): production.ERROR: Session store not set on request. {"userId":1,...
11 votes
4 answers
15k views

Vue + Laravel sanctum CSRF token mismatch 419 error

I get a "419 (unknown status)" error with the message "CSRF token mismatch." POST http://127.0.0.1:8000/login 419 (unknown status) CSRF token mismatch. Laravel server : http://127....
1 vote
0 answers
77 views

Error 401 Unauthorized - Laravel Sanctum + Oracle 11g Bearer Token in Docker

I am using Laravel v8, Laravel Sanctum v2.15, Oracle 11g, Linux Production Server which contains a Docker to use PHP 8.0.30. and oci8 v3.0.1 The backend is made with Laravel 8 by creating an API using ...
1 vote
1 answer
927 views

Error creating token with Laravel Santum when tokenable morph uses UUIDs

I am having problems when generating tokens with laravel sanctum. The error claims that the value is out of range for the column 'tokenable_id'. Here textual: SQLSTATE[HY000]: General error: 1366 ...
1 vote
2 answers
2k views

Laravel Sanctum Gives Error When Creating Token

I'm trying to setup Sanctum for logging in to my Laravel api. I am following the docs (also cross-referenced other articles online) but I'm getting an error back when I try to get a token with ...
0 votes
0 answers
129 views

Laravel 8 – API deploy in live server problem

I’m fairly new to Laravel and this post is mostly for learning purposes, so don’t mind the rudimentary approach, architecture and deploy method I’m using here. Also, it’s the first time I attempt to ...
3 votes
2 answers
7k views

SPA Authentication Issues with Sanctum and Postman

I'm currently trying to test an SPA using Laravel 8.19.0 and Postman 7.36.1 but I keep getting an "Unauthenticated" response from a route that's guarded by "auth:sanctum", even ...
0 votes
1 answer
122 views

tokenCan() method undefined

I am currently following this tutorial, https://nothingworks.netlify.app/blog/laravel-sanctum-multi-auth/ However when creating the middleware, the tokenCan method is undefined. <?php namespace ...
2 votes
3 answers
5k views

Laravel 8, Sanctum, Fortify /logout throws "CSRF token mismatch" in Postman

I installed L8, Sanctum, and Fortify for authentication. I was able to /login (used a Pre-request Script to set the X-XSRF-TOKEN). I even get the /api/user successfully. But when I do /logout, I get &...
0 votes
2 answers
2k views

Laravel 8 – Sanctum Personal Access Token – Web Route Secure With Redirect

One part of the goal here is to deepen my knowledge about the framework, so even if this isn’t “the right way”, I’d still like to try a solution to check if I should proceed with sanctum or passport. ...

15 30 50 per page
1
2 3 4 5