The Laravel framework is an open-sourced PHP web framework that allows developers to create dynamic and scalable web applications. The source code of Laravel is hosted on GitHub and released under the MIT license.
Questions tagged [laravel-sanctum]
585 questions
0
votes
2 answers
Laravel sanctum SPA application with javascript
I have used front side javascript(jquery) and backend Laravel with sanctum. Backend side I have used a virtual host.
-> frontend - localhost/login.html
-> backend - http://alkmy.local/login
env…

Mitul Koradiya
- 318
- 2
- 5
- 19
0
votes
2 answers
Laravel Sanctum (Former airlock) - How do I issue tokens for other models?
I am trying laravel sanctum for the first time.
I want to issue tokens for an Eloquent Model called Campaign.
This is my Campaign.php

Guilherme Assemany
- 678
- 6
- 18
0
votes
1 answer
How do I extend Laravel Sanctum's functionality?
I am specifically trying to get Sanctum's Guard class to look for the API token in a JSON request body if it can't find it in the Authorization header. I simply need to add an elseif after it checks for the bearer token.
So question is: What is the…

Aaron
- 179
- 9
-1
votes
1 answer
Access to XMLHttpRequest at 'http://localhost:8000/...' from origin 'http://localhost:3000' has been blocked by CORS policy 'laravel and react'
in my Laravel/react/xampp project i have an error when i try to edit the company info ;
In the terminal when i run php artisan serve it tels me updat and save methodes are not defined . and in my browser when i click save all to edit the company…

Chouich Nacereddine
- 24
- 5
-1
votes
1 answer
I need to make delivery today and I am stuck with the Square v2 payments API webhooks
I have integrated checkout API in my laravel app and now i am trying to utilize webhook -> payment.updated so then i can update the subscripton status of the user who made payment but i cannot access the Auth::user() i.e. the authenticated user on…

Omar Khan
- 1
- 1
-1
votes
2 answers
Laravel Sanctum CSRF Protection
So I am trying to configure Sanctum so that I would have CSRF protection for my API routes so that only my SPA's frontend would be able to make requests to it.
After following the documentation and doing the instructions in in this part of the…

Jheems
- 300
- 1
- 4
- 11
-1
votes
1 answer
How to validate if the Sanctum token i valid or not in laravel 9
I want to create an api to check if the token is expired or wrong on laravel 9 but when the token is wrong the postman gave me a response with html page and ignoring my middleware that validates the response .

ayaashraf
- 48
- 4
-1
votes
2 answers
How to set the X-XSRF-TOKEN or X-CSRF-TOKEN in the API Request Headers n Laravel and vue3
How can I set the XSRF-TOKEN in Laravel 8 on bootstrap.js.
According to the file it is being handled automatically but when i try to access the user data it returns unauthorized.
My bosstrap.js codes
window._ = require('lodash');
/**
* We'll load…

Tukei David
- 91
- 9
-1
votes
1 answer
Getting Cors error in Laravel sometimes and sometimes not
I hosted laravel (Laravel Framework 8.40) and reactjs application on a subdomain. I installed Laravel Sanctum and sometimes it's working perfectly and sometimes i got an error about cors.
I configured one staging environment and one production…

jerome gallego
- 124
- 4
-1
votes
1 answer
Laravel undefined method and undefined type
public function register(Request $request)
{
$validator = Validator::make($request->all(), [
'name' => 'required|max:191',
'name' => 'required|max:191',
'name' => 'required|max:191',
]);
…

Mehdad Hussain
- 91
- 2
- 8
-1
votes
3 answers
Set-Cookie not set cookies in my browser (React + Sanctum)
I am using Laravel sanctum to make auth With ReactJS
in cors.php. I have set these values
'paths' => ['api/*', 'api/csrf-cookie','/login'],
'supports_credentials' => true,
sanctum.php
'prefix'=>'api'
in React I use axios with…

cEthar
- 9
- 2
-1
votes
1 answer
Unauthorized error after several hours of inactive laravel sactum with vuejs
am beginner with vuejs. I am doing my first application with Vuejs with laravel sanctum as a package for token based authentication. My problem is when a user is logged in and stay inactive for several hours without signout from application , i got…

SAID KHAMIS
- 67
- 2
- 11
-1
votes
1 answer
Laravel 8 Sanctum: Is it required to extend from Authenticatable?
On the one hand, I have an Eloquent model User that extends Illuminate\Database\Eloquent\Model. On the other hand, I have SanctumUser extends Authenticatable (https://laravel.com/docs/8.x/sanctum#issuing-api-tokens).
What I would like to do is, User…

JarsOfJam-Scheduler
- 2,809
- 3
- 31
- 70
-1
votes
1 answer
Laravel 8, Sanctum and Angular 8
I have the subject environment in linux. I have made the configuration of cors.conf, session.conf, kernel:api with EnsureFrontendRequestsAreStateful, .env. All that is raccomanated in all documentation that i read.
Laravel in localhost:8000
Angular…

IT_StefanoSca
- 1
- 3
-2
votes
1 answer
Login, Register problem in laravel 8 Cpanel
The route is https://test.iqbal.live/api/auth/login/
field: username , password
enter image description here
In local environment its fine, when i upload it cpanel give the error below:
{
"message": "The GET method is not supported for this route.…

iqbal045
- 1
- 1
- 1