jeudi 28 mai 2020

php laravel 7 rest api upload file with passport token

what i try is to submit from from front end (anguler) a form with a file with user token in request header to my backend php laravel7 rest api

and when i try i have this error

 local.ERROR: Invalid stream reference provided {"exception":"[object] (Laminas\\Diactoros\\Exception\\InvalidArgumentException(code: 0): Invalid stream reference provided at C:\\inetpub\\jalssa\\jalssaBE\\vendor\\laminas\\laminas-diactoros\\src\\Stream.php:345)
[stacktrace]
#0 C:\\inetpub\\jalssa\\jalssaBE\\vendor\\laminas\\laminas-diactoros\\src\\Stream.php(60)

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;
});

i tried alot of other methods like

class VerificationController extends Controller
{
    public function __construct()
    {
        $this->middleware('client.credentials')->only(['postVerificationRequest']);
    }
...

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

lareval 7 passport token



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire