mercredi 26 octobre 2016

How I can use Laravel Passport Auth without Vue Component

I have installed Passport Auth in Laravel 5.3 using this documentation http://ift.tt/2blbtEU

but I have followed the steps before "Frontend Quickstart" heading now I have a API route:

Route::get('/user', function (Request $request) {
    //return $request->user();
    return json_encode(array(
      1 => "John",
      2 => "Mary",
      3 => "Steven"
    ));
})->middleware('auth:api');

and I am trying to hit api url via postman http://localhost/project/public/api/user

with Headers: Accept: application/json

It shows me this output:

{"error":"Unauthenticated."}

Please tell me how I can authenticate my API with passport auth? Also how I can generate access_token for authorization?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire