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

shoboske's avatar

shoboske wrote a reply+100 XP

3mos ago

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']);