Implementation using Laravel Framework v5.6 and Laravel Passport's Oauth2 Server and examples provided on how to consume the API from multiple front end frameworks and other apps.
- Node.js
- Laravel 5.6+
Install Laravel
$ composer install
Setup Laravel Auth
$ php artisan make:auth
Add Passport
$ composer require laravel/passport
Install Passport
$ php artisan passport:install
Run migrations
$ php artisan migrate
Add Passport Routes
In AuthServiceProvider.php
namespace App\Providers;
use Laravel\Passport\Passport;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
public function boot()
{
$this->registerPolicies();
Passport::routes();
}
}
Set Passport as Auth's API driver
In config/auth.php
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
],
Install Laravel Cors
$ composer require barryvdh/laravel-cors
Ionic 2 + Laravel Passport Login
(soon)
(soon)
(soon)
If you have any suggestions or improvements open an issue.
Software licensed under the MIT license.