dusterio / lumen-passport

Making Laravel Passport work with Lumen
MIT License
654 stars 141 forks source link

FatalErrorException in AccessTokenController.php line 27: syntax error, unexpected '[' #13

Closed Tellurian7 closed 7 years ago

Tellurian7 commented 7 years ago

Hi,

I'm using PHP v 5.6.28 and i get this error when i call oath/token (POST) :

Syntax at line 27 in vendor\dusterio\lumen-passport\src\Http\Controllers\AccessTokenController.php is not supported

$clientId = array_key_exists('client_id', (array) $request->getParsedBody())
                ? ((array) $request->getParsedBody())['client_id'] : null;

Replace by

$requestBodyArray = ((array) $request->getParsedBody());
$clientId = array_key_exists('client_id', $requestBodyArray) ? $requestBodyArray['client_id'] : null;

and it works.

Do i need a specific PHP configruation or something ? (array casting in ternary condition ?) Thanks.

paolopiccinini commented 7 years ago

the right issuse above

Tellurian7 commented 7 years ago

I'm using the latest version of lumen-passport, without the PHP7 ?? code and the array casting in ternary condition fail (syntax error)

paolopiccinini commented 7 years ago

I'm so sorry. I've linked the wrong issue. #10

Tellurian7 commented 7 years ago

No problem :) I didn't notice this issue was already reported.

himanshusinghs commented 7 years ago

@paolopiccinini @Tellurian7 @dusterio

I am facing 500 Internal Server Error on /oauth/token route with grant type password. But I can see my route here in routes list. image

paolopiccinini commented 7 years ago

what are log saying? go in yourApp/storage/logs