partabsaifzakir
1 year ago
242
23
Laravel

Consuming Your API With JavaScript - Issue

Posted 1 year ago by partabsaifzakir

I am using Laravel 5.7 with Vuejs, i'm new at this, i just need to secure my data. When i see Laravel passport documentation, i did same but not working, when i use ('auth:api') i can't see my users table and in Postman app it okay that i cannot see my data, i just add this in my Kernal.php.

'web' => [
    // Other middleware...
    \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,
],

and then i use this constructor in API controller named 'UserController'

class UserController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth:api');
    }

Please sign in or create an account to participate in this conversation.