php - View path return error 401 Bad credentials -
i building web api , stuck following issue. when call following path : localhost:8000/add browser returns
code":401,"message":"bad credentials
here code: defaultcontroller.php (src/appbundle/controller/defaultcontroller.php)
class defaultcontroller extends controller { /* * @route("/add", name="add_user") */ public function addaction() { $number = mt_rand(0, 100); return new response('lucky number: '.$number.' ' ); } }
routing.yml (app/config/routing.yml)
add_user: path: /add defaults: { _controller: appbundle:default:add }
any appreciated.
the bad credentials
message tells security behind api , should use credentials access api.
and in opinion should return jsonresponse
instead of response
Comments
Post a Comment