Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

christaiwo's avatar

How to Stop WorkOS From Automatically Creating Users in a Laravel 12 App

I want to disable automatic user creation triggered by WorkOS in a Laravel 12 app.

I already disabled self-registration in the WorkOS dashboard, so users no longer see the registration page. The issue is that when a user clicks the login button, if the account exists in WorkOS, the callback flow still creates a new user record in my Laravel app.

In my setup, only an admin should create users. We use one WorkOS directory for multiple applications, so a user might authenticate globally, but access to each platform must be controlled from our admin panel. Because of this, I need WorkOS to authenticate users without automatically creating them in Laravel.

I want to know how to stop the WorkOS callback from creating users and instead allow login only for users already created by the admin.

0 likes
1 reply
shoboske's avatar

Hi @christaiwo ,

The easiest way for you to do this will be to create your own logic for creating users and pass it into the authenticate method. see example below. and that will throw an error while attempting to create new users.

 // in auth.php
Route::get('authenticate', function (AuthKitAuthenticationRequest $request) {
    return tap(redirect()->intended(route('dashboard')), fn() => $request->authenticate(createUsing: function ($workosUser) {
        throw new Exception('No one is allowed to login yet.');
    }));
})->middleware(['guest']);

Please or to participate in this conversation.