PHPackages                             mannysoft/api-auth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. mannysoft/api-auth

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

mannysoft/api-auth
==================

Laravel package for extending Laravel Passport

0.3(6y ago)1237MITPHPPHP &gt;=7.2.0

Since Sep 19Pushed 6y ago1 watchersCompare

[ Source](https://github.com/mannysoft/api-auth)[ Packagist](https://packagist.org/packages/mannysoft/api-auth)[ RSS](/packages/mannysoft-api-auth/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

Laravel API Authentication
==========================

[](#laravel-api-authentication)

Laravel package for authentication in API.

Installation
------------

[](#installation)

Require this package with composer.

```
composer require mannysoft/api-auth
```

```
php artisan migrate
```

```
php artisan passport:install
```

```
php artisan passport:keys
```

```
php artisan vendor:publish --provider="Mannysoft\ApiAuth\ServiceProvider" --tag="migrations"
```

Open your `oauth_clients` table and look for `password_client`

Change your .env

`APP_OAUTH_CLIENT_ID=`

`APP_OAUTH_CLIENT_SECRET=`

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the `ServiceProvider`.

add the `Laravel\Passport\HasApiTokens` trait to your `App\User` model. This trait will provide a few helper methods to your model which allow you to inspect the authenticated user's token and scopes:

```
