I was created one project with laravel 5.4 and custom authentication to one table of Dynamics NAV (2017) trough web services, these are the steps that I was make to do this:
- I was folow some steps As this article explains perfectly: CustomUserProvider.php
-
- Modify config/auth.php:
'providers' => [ 'users' => [ //'driver' => 'eloquent', 'driver' => 'customuserprovider', 'model' => App\User::class, ], // 'users' => [ // 'driver' => 'database', // 'table' => 'users', // ], ],
- but then Modify providers/AuthServiceProvider to use my own customuserprovider:
<?php namespace App\Providers; use Illuminate\Support\Facades\Gate; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; class AuthServiceProvider extends ServiceProvider { /** * The policy mappings for the application. * * @var array */ protected $policies = [ 'App\Model' => 'App\Policies\ModelPolicy', ]; /** * Register any authentication / authorization services. * * @return void */ public function boot() { $this->registerPolicies(); // added to modify auth provider that's the trick \Illuminate\Support\Facades\Auth::provider('customuserprovider', function($app, array $config) { return new CustomUserProvider($app['hash'], $config['model']); }); // } }
- Modify config/auth.php:
-
![Share on Facebook Facebook](https://www.colome.org/wp-content/plugins/social-media-feather/synved-social/image/social/regular/64x64/facebook.png)
![Share on Twitter twitter](https://www.colome.org/wp-content/plugins/social-media-feather/synved-social/image/social/regular/64x64/twitter.png)
![Share on Reddit reddit](https://www.colome.org/wp-content/plugins/social-media-feather/synved-social/image/social/regular/64x64/reddit.png)
![Pin it with Pinterest pinterest](https://www.colome.org/wp-content/plugins/social-media-feather/synved-social/image/social/regular/64x64/pinterest.png)
![Share on Linkedin linkedin](https://www.colome.org/wp-content/plugins/social-media-feather/synved-social/image/social/regular/64x64/linkedin.png)
![Share by email mail](https://www.colome.org/wp-content/plugins/social-media-feather/synved-social/image/social/regular/64x64/mail.png)