Skip to content

Instantly share code, notes, and snippets.

@joselfonseca
Created May 25, 2017 12:52
Show Gist options
  • Select an option

  • Save joselfonseca/f608720fb3deefee44600e9b1583c019 to your computer and use it in GitHub Desktop.

Select an option

Save joselfonseca/f608720fb3deefee44600e9b1583c019 to your computer and use it in GitHub Desktop.
<?php
namespace App\Providers;
use Carbon\Carbon;
use Laravel\Passport\Passport;
use Joselfonseca\LaravelApiTools\Auth\PassportAuthenticationProvider;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
Passport::routes();
Passport::tokensExpireIn(Carbon::now()->addHours(10));
Passport::refreshTokensExpireIn(Carbon::now()->addDays(3));
app('Dingo\Api\Auth\Auth')->extend('passport', function ($app) {
return app(PassportAuthenticationProvider::class);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment