Level 1
Quick follow up Having an echo seems blocking the auth from executing ?
I removed echo statements, the login worked as intended
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
So I am using a route to quickly login a user from an external call Works as simple as below
$userId = request('user_id');
Auth::loginUsingId($userId);
});```
But althought its not a secure app (and does not have to be) , I wanted to add a small protection from a token post included
So I added the below code and loginusingId stops working, any explanation why or what stops its execution ?
Not working code :
`Route::get('/loginas', function () {
$userId = request('user_id');
$rtoken = request('rtoken');
//testing referrer protection
$appsd = env('APP_secret_digit');
$token= $appsd*$userId;
echo $token;
echo $rtoken;
if ($token == $rtoken) {
//echo "true"; / shows up to here.. but no longer keeps session
Auth::loginUsingId($userId);
}
});`
Please or to participate in this conversation.