I hope this is the right place to ask this – if not, please direct me to the appropriate forum. I’ve been doing a lot of research all day on the best route to take with an application that I’m developing and would appreciate your advice. Here are the basics. I am building a ReactNative ..
Category : laravel-sanctum
I have recently upgraded an old app to Laravel 8 and subsequently installed Sanctum for api authentication. I understand the use case for Sanctum when the front end is a SPA but as my app is legacy it uses a combination of react and Laravel blade views. When a user logs in it generates a ..
I am using Shopify Webhook on order insert so I can have the order inserted in my application too and for that, I use Laravel Sanctum to know the order belongs to which user so it can be inserted with the user_id When I make a test using Postman everything goes okay but when I ..
I have API developed with Laravel 8 and Sanctum. I’ve set up to let users register and login and protected routes with sanctum. But how do I do to get the user’s account details from his access token? This is how I’ve done the sign up and login: public function signup (Request $request){ $request->validate([ ‘name’ ..
I am working on a project, the client side is made with nuxt, nuxt-auth package to manage the authentification with laravel sanctum. Everything is working well (register, login) but After an $auth.logout(), the user is logged out but i can’t login again until i remove the laravel_session cookie from my navigator. this is the error ..
I am trying to implement a simple project using Laravel API as backend and VueJs as frontend. I use Laravel Sanctum for authentication. Everything works fine, however, after i redirect to external url (payment gateway) my user session gets destroyed and user have to login again after the response from the external url. my settings ..
I am trying to implement a simple project using Laravel API as backend and VueJs as frontend. I use Laravel Sanctum for authentication. Everything works fine, however, after i redirect to external url (payment gateway) my user session gets destroyed and user have to login again after the response from the external url. My settings ..
I have a Laravel application that I’ve built to act only as a JSON API. It has no views, and acts only to support our 1st party SPA. It uses Laravel 8, Fortify, and Sanctum. My SPA lives at my-app.test, and the api at api.my-app.test. The SPA works as expected. However, if I visit one ..
I am facing error when using auth:sanctum middleware in my normal laravel website. BadMethodCallException Method IlluminateAuthRequestGuard::viaRemember does not exist. Sourc..
I’m using laravel sanctum and I add to middleware to my route: Route::group([‘middleware’ => ‘auth:sanctum’], function () { Route::post(‘/sms-log’,[SmsLogController::class, ‘store’] ); }); But insomnia want me to sign in: insomnia_ss when I remove middleware from api route working as expected. so how can I add basic auth? Sourc..
I am using VueJS and Laravel API SPA with Sanctum. While submitting my login details on localhost:8000/login i face no issue, however, while trying to run the same using 127.0.0.1:8000/login i get a message "CSRF token mismatch." my settings are as under .env file SESSION_DRIVER=cookie SANCTUM_STATEFUL_DOMAINS=127.0.0.1:8000,localhost:8000,localhost:3000,127.0.0.1:3000 SESSION_DOMAIN=localhost,127.0.0.1 cors: ‘paths’ => [‘api/*’, ‘sanctum/csrf-cookie’], ‘allowed_methods’ => [‘*’], ..
I am using Sanctum for SPA authentication. In several examples I have seen, people are creating auth routes (login, logout, register) in their web.php routes file as opposed to the api.php routes file. Is there a reason for this? In the documentation I do see a mention here… You may be wondering why we suggest ..
I have problem with laravel sanctum usage in Angular SPA application. Acutal documentation for laravel 8.x says: If the login request is successful, you will be authenticated and subsequent requests to your application’s routes will automatically be authenticated via the session cookie that the Laravel application issued to your client. In addition, since your application ..

SPA : localhost:8080 vue 3/ vuex 4/ axios / typscript Laravel : domain.test //api for api access, /nova for nova access, web routes for public access laravel 8 / sanctum / nova / fortify error on posting to /login: config/fortify.php <?php use AppProvidersRouteServiceProvider; use LaravelFortifyFeatures; return [ ‘guard’ => ‘web’, ‘passwords’ => ‘users’, ‘username’ => ..
After migrating from Laravel 5.6 to Laravel 7, middleware that has a ":" in It does not work. For example "auth:basic" or "auth:sanctum": Route::middleware([‘auth:basic’])->group(function () { }); If I use It as auth.basic, It works perfectly, but not auth:basic. The exeption is: message: "Function name must be a string", exception: "Error", file: "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", I would ..
I have the following set-up: Laravel running with Homestead Domain laravel-api.test pointing to my Homestead environment React (npx create-react-app) running locally with a custom HOST app.laravel-api.test:3000 Laravel In my routes (routes/api.php) I added two routes: Route::post(‘login’, [AppHttpControllersLoginController::class, ‘login’]); Route::middleware(‘auth:sanctum’)->get(‘books’, [AppHttpControllersBookController::class, ‘list’]); In my config/cors.php I added: ‘paths’ => [‘api/*’, ‘sanctum/csrf-cookie’], ‘allowed_methods’ => [‘*’], ‘allowed_origins’ => ..
I’m making an API using Laravel and I’m building the login system. When I’m trying to get the logged user I get 401 error when the login seems to work. Here’s my vuex module where I have my action to login the user: import axios from ‘@/api’; export default { namespaced: true, state: { user: ..
I was asked to create a React app that allows users to interact with a wireguard vpn – add and remove users, look at logs, see who is currently logged in..etc. So I’m starting the project by making a react front end and a laravel api that is hosted on the same server as the ..
I was asked to create a React app that allows users to interact with a wireguard vpn – add and remove users, look at logs, see who is currently logged in..etc. So I’m starting the project by making a react front end and a laravel api that is hosted on the same server as the ..
This is a strong doubt that I have, I will put you in context: I need to create a distributed system, in my general diagram I have an API server and an authentication server, both servers are separated. So, I want to manage my authentication via OAuth 2 Password Grant Tokens using Laravel, but I’m ..
I want to generate a jwt token using sanctum without user login! $user = DB::table(‘social_facebook_accounts’) ->select(‘id’ ,’provider_user_id’,’provider’) ->get() ->sortByDesc(‘updated_at’) ->first(); if($user->provider_user_id == $userid){ $success[‘token’] = $user->createToken(‘facebook’)->accessToken; return response()->json([‘success’ => $success], $this->successStatus); }else{ return response()->json([‘error’=>’Unauthorised’], 401); } error I am getting => Call to undefined method stdClass::createToken() Sourc..
I am using Laravel sanctum with react. I am trying to logout but It is not working I don’t know what went wrong. Is this the right way? My controller does not receive anything when I try $request->user. do I need to pass anything as a header while requesting to logout? //axios config window.axios = ..
I am using Laravel Sanctum to authenticate and apply CSRF tokens to my React SPA. The documentation says that setting the csrf header should be handled automatically for me but that has not been my experience. I have seen some posts suggesting to disable http_only but surely disabling this isn’t the right way to go ..
I have a Laravel 7 API with Sanctum authentication, VueJS (Nuxt SPA) frontend. After registration (Laravel auth scaffolding) the user must verify their email address. Generally the app+auth is working fine but I’ve noticed that the following is possible: User registers an account User gets an email with the verification URL and uses it, handled ..
From reading the Laravel docs, it appears that when using Sanctum Vue will just use the cookie-based authentication. I was trying to move an existing app (with login done using Livewire) to Vue, but calls direct to my first api endpoint were redirecting to the login page. So I created a clean installation of Larvel, ..