dev-master
9999999-devLaravel package for extending Laravel Passport
MIT
The Requires
- php >=7.0.0
- laravel/passport ^5.0
- laravel/socialite ^3.0
- mannysoft/api-form-request dev-master
- tymon/jwt-auth ^1.0.0-rc.2
by Manny Isles
laravel api auth
Wallogit.com
2017 © Pedro Peláez
Laravel package for extending Laravel Passport
Laravel package for authentication in API., (*1)
Require this package with composer., (*2)
composer require mannysoft/api-auth
```shell php artisan migrate, (*3)
```shell php artisan passport:install
```shell php artisan passport:keys, (*4)
```shell php artisan vendor:publish --provider="Mannysoft\ApiAuth\ServiceProvider" --tag="migrations"
Open your oauth_clients table and look for password_client, (*5)
Change your .env, (*6)
APP_OAUTH_CLIENT_ID=, (*7)
APP_OAUTH_CLIENT_SECRET=, (*8)
Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider., (*9)
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:, (*10)
<?php
namespace App;
use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use HasApiTokens, Notifiable;
}
Update your config/services.php if you are using login with facebook, (*11)
'facebook' => [
'client_id' => env('FACEBOOK_CLIENT_ID'),
'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
'redirect' => env('FACEBOOK_REDIRECT'),
],
Update your config/api-auth.php depending in your needs, (*12)
Finally, in your config/auth.php configuration file, you should set the driver option of the api authentication guard to passport. This will instruct your application to use Passport's TokenGuard when authenticating incoming API requests:, (*13)
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
],
To get started, override the sendPasswordResetNotification method on your User model. Within this method, you may send the notification using any notification class you choose. The password reset $token is the first argument received by the method:, (*14)
/**
* Send the password reset notification.
*
* @param string $token
* @return void
*/
public function sendPasswordResetNotification($token)
{
$this->notify(new \Mannysoft\ApiAuth\Notifications\ResetPasswordNotification($token, $this->email));
}
| Route | Are | Cool |
|---|---|---|
| Config | Value | Default |
|---|---|---|
| login_facebook | ||
| login_accountkit | ||
| login_url | ||
| logout_url | ||
| forgot_password | ||
| change_password | ||
| username | ||
| reset_password_deep_link | ||
Laravel package for extending Laravel Passport
MIT
laravel api auth