Questions tagged [laravel-airlock]

Laravel Airlock provides a featherweight authentication system for SPAs and simple APIs.

At the moment there is no stable release yet. Details can be found on Github repository page.

15 questions
12
votes
3 answers

Laravel sanctum csrf cookie every request?

I'm using Laravel sanctum (former Airlock) and have a question about it. I read in the docs: To authenticate your SPA, your SPA's login page should first make a request to the /sanctum/csrf-cookie route to initialize CSRF protection for the…
Ezrab_
  • 825
  • 5
  • 19
  • 44
6
votes
0 answers

Test throws RequestGuard::viaRemember() does not exist on second request

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', 'image/jpeg'); $this->post('/account/missing-fields/upload', [ …
Jazerix
  • 4,729
  • 10
  • 39
  • 71
2
votes
1 answer

Laravel airlock / sanctum auth check

How I can get or check auth user without auth:sanctum. I try get auth user auth()->user() from guest route but I get only null. And yes I pass token but still get null nested user. But if I try with route inside auth:sanctum all ok.
rus131354
  • 348
  • 4
  • 11
1
vote
1 answer

Laravel Sanctum returns 500 when trying to access sanctum protected API

I am using Laravel 8.12 with PostgreSQL. I am trying to use Laravel Sanctum as authentication for my API. This is the schema for sanctum:
Axel
  • 4,365
  • 11
  • 63
  • 122
1
vote
1 answer

Laravel Airlock vs Laravel Passport

Can i get posts, or create new posts with Laravel Airlock tokens, or for create or updated any rows in database i need use Laravel Passport?
rus131354
  • 348
  • 4
  • 11
0
votes
0 answers

Laravel Sancrum/Airlock

I'm trying to host a Laravel API (Sever) project on Heruko along with Vue js project separately, 2 individual project. Is it possible to use laravel airlock/sanctum to authenticate user on the heruko free given domain?
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
0
votes
1 answer

Airlock alias Sanctum doesn't set the csrf token in cookie after the csrf request from axios to a laravel backend

I have a virtualhost in laravel who use Airlock for handling authentication. In a SPA i make a request with axios to get the CSRF token that i would use for login according to documentation. But i can't make the response set the cookie. I have no…
0
votes
1 answer

axios.get /airlock/csrf-cookie doesn't take effect in laravel 7

I am using laravel airlock auth on my SPA project. As per documentation https://laravel.com/docs/master/airlock, there is a need of the code below in loggin in: axios.get('/airlock/csrf-cookie').then(response => { // Login... }); However, when…
smzapp
  • 809
  • 1
  • 12
  • 33
0
votes
1 answer

CSRF token mismatch laravel airlock axios

Airlock Version: 1.0.0 Laravel Version: 7.0.0 PHP Version: 7.2.0 Database Driver & Version: MySql 5.7.23 Description: I try login with axios from different domain. I've the core in "mydomain.com" and the react site in "seconddomain.com". If I try…
LionAlex
  • 23
  • 4
0
votes
2 answers

Laravel Airlock how to return different responses for unauthenticated web and api requests

I am developing a mobile app and website with laravel + react native. When you send a request to a route with "auth:airlock" middleware, If you pass wrong Bearer token it redirects you to /login page. I want to return response("Unauthenticated",…
haberimyok
  • 13
  • 3
0
votes
1 answer

Laravel Airlock route for authenticated + unauthenticated

I'm using the new Laravel Airlock package for an app I'm building. I have a route that can be accessible for authenticated and unauthenticated users. In the controller I check if the user is authenticated with Auth::check();. My route looks like…
Jamie
  • 10,302
  • 32
  • 103
  • 186
0
votes
1 answer

laravel airlock issue with creating tokens: 'tokenable_id' cannot be null

Have upgraded to Laravel 7 and have installed Laravel/Airlock. Having followed the installation instructions if try to create a token i get an error SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'tokenable_id' cannot be null (SQL:…
ShopApps.co.uk
  • 93
  • 2
  • 12
0
votes
1 answer

Laravel Airlock - CSRF token mismatch

I've been trying to get Laravel Airlock to work with a new web app I'm developing but no matter what I try, I can't get it to work. airlock.php has the following set: 'stateful' => ['https://control.domain.tld', …
Dally
  • 1,281
  • 4
  • 18
  • 37
0
votes
1 answer

Laravel / Airlock AJAX login - 419 (unknown status)

I'm trying to do a cross origin login request and everything except logging in is working. So if I go to api.example.com and log in with the laravel app and then go to www.example.com I can get the user by calling the /api/user end point (setup as…
JSP
  • 547
  • 1
  • 4
  • 18