array_key_exists() expects parameter 2 to be array, null given
Closed this issue · 1 comments
Abonive commented
I have implemented everything like in the guide.
But when I try to request token I get this error
array_key_exists() expects parameter 2 to be array, null given
and it refers to this section
$body = (parent::issueToken($request));
$token = json_decode($body, true);
if (array_key_exists('error', $token)) {
return response()->json([
'error' => $token['error'],
'status_code' => 401
], 401);
}
in the issueToken
method
jsdecena commented
Can you try
if (isset(token['error']) && array_key_exists('error', $token)) {
return response()->json([
'error' => $token['error'],
'status_code' => 401
], 401);
}