authentication - Laravel JWTAuth::encode , JWTAuth::attemp , JWTAuth::fromUser, unable to create a token, and throwing error -
laravel jwtauth::encode , jwtauth::attemp , jwtauth::fromuser, unable create token, , throwing error
thats whole response getting,
the login route in routes.php this:
route::post('auth/login','authcontroller@login'); and login function in authcontroller.php this:
function login(request $request){ $user = user::where('email', '=',$request['email']) ->first(['first_name', 'last_name', 'email', 'id', 'hashed_password']); // if email , password wrong if(count($user) <= 0 ) return response(["success"=>false,"message"=>"authentication failed, wrong credentials"],401); //sendresponse(false, "authentication failed, wrong credentials", null, 401); if (!hash::check($request['password'], $user['hashed_password'])) { return response(["success"=>false,"message"=>"authentication failed, wrong credentials"],401); } try{ // attemp verify credentials , create token user $payload = jwtfactory::make($user['original']); $token = jwtauth::encode($payload); $user['jwt'] = $token; $user->save(); } catch(exception $e){ // went wrong while creating token or updating user return response(["success"=>false,"message"=>"there's wrong, soon."],400); } $content['message'] = "successfully login"; $content['success'] = true; $content['token'] = $user['jwt']; $content['data']['first_name'] = $user['first_name']; $content['data']['last_name'] = $user['last_name']; $content['data']['email'] = $user['email']; return response($content,200) ->header('content-type', "application/json"); } i stuck on error 2 days, , still unable find solution. tried maximize nesting level adding following line in php.ini
;xdebug.max_nesting_level=1000 but didn't work.
kindly help.
looking @ error message, still acting on default xdebug.max_nesting_level.
from you've showed changed in php.ini file - you've updated xdebug.max_nesting_level left commented out won't take affect.
you need uncomment removing ; before it, looks this:
xdebug.max_nesting_level=1000
then restart services take affect.
Comments
Post a Comment