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

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -