I am creating RESTful
API with Laravel (BackEnd)
and AngularJS (Front End)
, I want to implement OAuth
to secure my API of Laravel.
I've Installed a OAuth
in my laravel but when i call a request on server from angularjs then it gives error of invalid_request.
Here is my Code :
Laravel Side :
Route::post('oauth/access_token', function() {
return Response::json(Authorizer::issueAccessToken());
});
Angular Side :
$http({
url: $url.siteUrl('oauth/access_token?grant_type=password&username=stafftest&password=password'),
method: "post",
headers: {'Content-Type': "application/x-www-form-urlencoded"},
}).then(function(response) {
console.log(response);
}, function(response) {
console.log(response);
});
I get Error like :
{
"error":"invalid_request",
"error_description":"The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the 'grant_type' parameter."
}
What is the problem any ideas?
Thanks.... :)