3

I have a project in Laravel 5.2 and now I have to make the APIs for that. I tried to hit the localhost/myproject/login via postman as a post request with the parameters but it returns me the HTML in return. I have used Laravel's auth scaffolding for the authorization. I am unable to find postLogin function in my project. I have separated the routes but how can I change the existing functions for the API?

Route::group(array('prefix' => 'api/v1'), function()
{
    Route::post('login', 'AuthController@postLogin');
});
baig772
  • 3,404
  • 11
  • 48
  • 93

1 Answers1

0

Here is the postLogin that returns the json rather than the html code.

public function authenticate()
{
    if (Auth::attempt(['email' => $email, 'password' => $password])) {
        // Authentication passed...
        //return redirect()->intended('dashboard');
        return response()->json(['status' => 1]);
    }
}

If you have any trouble, let me know.

supernova
  • 398
  • 1
  • 3
  • 15