Questions tagged [laravel-sanctum]

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.

585 questions
0
votes
1 answer

Laravel v8.15.0 (PHP v7.3.23) An API for Mobile Application on a Shared Server POST Routes not working

I'm on Shared Server. Laravel v8.15.0 (PHP v7.3.23) unable to set it up properly. Sanctum & Passport both tried but that crashes with 500 Internal Server Error. So removed them. https://townies.pk/api/v1/getCart is working. Another GET route for…
Ronnie Depp
  • 159
  • 3
  • 12
0
votes
0 answers

Email Verification using API and Laravel Sanctum

I want to verify email, when user change it or create new account. I found this solution: https://laravel.com/docs/8.x/verification , but probably it not prepared for Laravel Sanctum solution. The problem is with request authorization (last…
Cliassi
  • 81
  • 3
  • 10
0
votes
0 answers

Can't get authenticated data

I have this global middleware that updates user's last activity
user14624737
0
votes
3 answers

Laravel Sanctum Retrieve PlainTextToken without creating a new token

I am creating a SPA with vue and laravel. I know i can issue out tokens for every user and store it as a new entry on the database. And from the documentation, I can only list out all the tokens available to a user in hashed format with laravel and…
myestery
  • 105
  • 1
  • 11
0
votes
1 answer

Vue SPA Authentication using Laravel Sanctum

I am currently using Laravel Sanctum for my Laravel Project with Vue SPA. I just wanted to ask, do I have to create my own Controllers to handle Login and Register or just use the Laravel default controllers installed when I run php artisan ui vue…
alex goot
  • 25
  • 7
0
votes
1 answer

401 (Unauthorized) while fetching user using laravel Sanctum with api token authentication

I watched this tutorial for api token authentication with laravel sanctum. When logging in, I retrieve a Bearer token which I add to the axios header. But when trying to fetch the user via /api/user, I get a 401. Notice that I don't use CSRF tokens…
0
votes
1 answer

Why did sanctum middleware return error (unauthorized 401) in Laravel?

I I want to make authentication in SPA with laravel sanctum. And I seted enviroment like below code. But after I logged in and next api request, error happen. Why?. First request returned X-CSRF-TOKEN . And As far as I know, axios submit…
0
votes
0 answers

Laravel Vue spa get current auth user details

I'm using Vue and Laravel Sanctum to handle login. This is my html form
Name
Password
user3714932
  • 1,253
  • 2
  • 16
  • 29
0
votes
1 answer

Cannot be authenticated in Dusk using sanctum

I'm trying to make login page using Laravel sanctum and React. I can login in my browser (can see 'authenticated' message), but I cannot login in Dusk. To be exactly, I can login once in Dusk but I'm not authenticated in next access. I cannot…
keciek3
  • 3
  • 2
0
votes
3 answers

NuxtJs app returns 401 after log in with laravel sanctum

I'm trying to build a PWA with NuxtJS and Laravel is in the backend for the API. I use Laravel Sanctum for API auth and also I have NuxtJS auth module, I can login (I know this because it returns and sets all of the cookies) but when it's requesting…
Aimal
  • 91
  • 5
0
votes
1 answer

A cookie not in document.cookie list while http_only = false

I have a Nuxt.js frontend application, which performs an authentication request. There is a Laravel/Sanctum application on the backend. It uses built-in cookie-based session authentication. The authentication request fails because no X-XSRF-TOKEN…
0
votes
0 answers

Is it possible to make Laravel Sanctum work with tokens and auth at the same time?

I'm currently using Laravel with VueJS for a web app. Using Sanctum for the API works great. However, I also created a small Android app. This android app requires the token creation in order to authenticate. To make it work, I have to remove the…
Inigo EC
  • 2,178
  • 3
  • 22
  • 31
0
votes
0 answers

How to setup Sanctum in laravel to work with Android apps? Getting 419 error

I have an hybrid vuejs app, that is working correctly on the web version, but that is getting 419 from the Laravel server when calling it from the Android version. AXIOS CALL vm.axios.get('/sanctum/csrf-cookie').then(response => { vm.logging =…
Inigo EC
  • 2,178
  • 3
  • 22
  • 31
0
votes
2 answers

How can I access the API routes with Laravel Sanctum without a SPA or graphic interface, only by POSTMAN?

I am working with Laravel Sanctum for the first time, especially with the API's. I had to create an API that is only for reporting that returns a JSON, the topic that I can't access by POSTMAN since it tells me "message": "Unauthenticated." I…
Alex Valenzuela
  • 189
  • 2
  • 15
0
votes
2 answers

Laravel Sanctum and Tenancy unauthenticated API Token

I've a problem with Laravel Sanctum, I've been googling for almost 1 week and have not found the solution, I use Sanctum with hyn/multi-tenant, I don't use SPA authentication but API Token authentication. The tenant authenticates well and generates…