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

damku999's avatar

php laravel 7 rest api upload file with passport token

what I try is to submit from the front end (Vue) a form with a file with user token in the request header to my backend PHP laravel7 rest API

and when I try I have this error [2020-06-10 14:39:53] local.ERROR: Invalid stream reference provided {"exception":"[object] (Laminas\Diactoros\Exception\InvalidArgumentException(code: 0): Invalid stream reference provided at C:\inetpub\wwwroot\passport_test\vendor\laminas\laminas-diactoros\src\Stream.php:345) [stacktrace] #0 C:\inetpub\wwwroot\passport_test\vendor\laminas\laminas-diactoros\src\Stream.php(60): Laminas\Diactoros\Stream->setStream('', 'r') #1 C:\inetpub\wwwroot\passport_test\vendor\laminas\laminas-diactoros\src\StreamFactory.php(41): Laminas\Diactoros\Stream->__construct('', 'r'); my route code

Route::middleware('auth:api')->post('/postVerificationRequest', function (Request $request) { \Log::info('start 111111 '.$user);

$user= $request->user();


\Log::info('start 22222222  '.$user);

if($user!= null && $user->id> 0)
{
    return app('App\Http\Controllers\API\VerificationController')->postVerificationRequest($user->id);
}

return $user;

}); what I need is just any direct way that I can validate passport token within my controller function the easy direct way I will send the token as a parameter or within a request header

lareval 7 passport token

0 likes
0 replies

Please or to participate in this conversation.