laravel-sanctum Questions

4

Solved

How to retrieve the 'logged in' user from a Sanctum token. For logging in I have the following method public function login(Request $request) { if (Auth::attempt($request->toArray())) { /* @v...
Merilynmeringue asked 1/7, 2020 at 21:35

1

We built an API (which currently contains just a single route) to give access to specific data to another company we are working with. The API calls this other company performs to our endpoint are ...
Skim asked 18/2, 2021 at 15:19

4

Solved

I'm passing to the server in the POST request body the Token of the user. I need to find out which user this token belongs to. In laravel/sanctum documentation I found out that it is possible to do...
Imprimatur asked 6/5, 2021 at 9:28

5

Solved

I have been trying to implement Laravel sanctum, but I am having this error "CSRF token mismatch" even though I followed everything that is said in the Laravel Sanctum documentation cors.php confi...
Poteat asked 6/4, 2020 at 15:38

4

I am using Laravel with default integration of Vue (Not separate project using Vue CLI). I'm trying to authenticate a user but it always shows 419 error. I have included the csrf token to the Axios...
Grayback asked 21/8, 2020 at 17:18

2

I have a nicely working basic install of Laravel JetStream and Spatie's laravel-permission in Laravel 8. I can assign a role to the user during registration via $user->assignRole('visitor'); ret...

1

Solved

I am using laravel sanctum for API authentication for my mobile app. How can we limit the maximum number of active tokens per user? Currently, in the personal_access_tokens sanctum generated table,...
Miriam asked 15/7, 2021 at 10:54

2

Structure of the project: 2 folders namely api and client, where api is used for laravel installation and client refers to the nuxt project. Laravel (v-8.00) setups: This is what I have in .env fil...
Reconstruct asked 11/10, 2020 at 10:46

1

Solved

I am creating API with sanctum, and works fine I can list users, update, store, etc. I added middleware auth:sanctum and passing token, and I add middleware EnsureFrontendRequestsAreStateful like e...
Feeder asked 1/9, 2020 at 8:9

2

So it's been several hours I couldn't figure out the issue even reading through and trying any possible solution available on the internet. I'm using Laravel 7.x with Vue js and struggling with San...
Kinghood asked 13/6, 2020 at 2:20

1

Currently, my SPA is simple and has only a contact form. The form data is sent to the backend. I have installed Laravel Sanctum for that. axios.get('/sanctum/csrf-cookie').then((response) => {...
Recumbent asked 2/6, 2020 at 8:38

1

Solved

I have a Laravel website served by Valet on backend.test and a Nuxt SPA on nuxt.backend.test:3005. When I try to authenticate to Sanctum with Nuxt Auth module, I get the CORS error below: Access...
Reductase asked 31/5, 2020 at 11:50

0

I have a test that looks like so: $user = factory(User::class)->state('verified')->create(); $this->be($user); $file = new UploadedFile(storage_path('testing/user.jpg'), 'user.jpg', 'ima...
Oust asked 15/5, 2020 at 16:43

1

Solved

Overview I have a Laravel powered api locally hosted at http://tenant.api.hydrogen.local and an Angular 9.2 SPA which is being served on http://localhost:8100. I recently installed Laravel Sanctum...
Bitumen asked 1/5, 2020 at 0:41

2

Solved

I'm trying to test an authenticated API route which only an authenticated user can post to a specific route. Looking at the Laravel Sanctum docs, I can use the code below to create and authentica...
Lambdacism asked 11/4, 2020 at 0:49

1

What are the differences between these 2? And which one is better for a simple VueJS app? I've read their documents a few times but still confused. Thank you very much.
Donitadonjon asked 23/3, 2020 at 11:40

© 2022 - 2025 — McMap. All rights reserved.