简体   繁体   中英

Laravel Passport API error in create token

Although project work fine in local, when deploy on server found error. laravel 7 php version 7.4.13

ParseError: syntax error, unexpected 'Parser' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in file /var/www/html/laravel/vendor/lcobucci/jwt/src/Configuration.php on line 22

ParseError:语法错误,意外的'Parser'(T_STRING),期望函数(T_FUNCTION)或const(T_CONST)在文件/var/www/html/laravel/vendor/lcobucci/jwt/src/Configuration.php第22行

public function verifyOtp(Request $request)
{
    $phoneno = $request->input('loginId');
    $enteredOtp = $request->input('password');

    $loginData = [
        'login_id' => $phoneno,
        'password' => $enteredOtp
    ];

    // dd($loginData);
    if (!auth()->attempt($loginData)) {
        return response([
            'message' => 'OTP incorrect!',
            'status'=>0
        ]);
    } else {
        // dd("Here");
         $accessToken = auth()->user()->createToken('authToken')->accessToken;
         return response([
                'user' =>auth()->user(),
                'access_token' =>$accessToken,
                'message'=>"Successfully login",
                'status'=>1
        ]);
    } 
}

You would need PHP 7.4+ to use the code base you currently have. The version of the package that the error is coming from uses features from PHP 7.4.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM