[8.x] Sanctum #5663
[8.x] Sanctum #5663
Conversation
this is so cool please merge .... as since I started using laravel from 2016 i never used the default API driver |
this is so cool |
|
||
'api' => [ | ||
'driver' => 'token', | ||
'provider' => 'users', | ||
'hash' => false, | ||
], |
Just started a new projec. Was about to remove the default token based authentication... Was thrilled to see sanctum already setup! Love this |
With this PR merged all our packages failed on integration for
Solution to that was to add public function boot() {
$config = $this->app->make('config');
$config->set('auth.guards', array_merge(
[
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
],
$config->get('auth.guards', [])
));
} I'm posting this since finding the solution at this time was impossible with searching issues/forums/etc. |
@qunabu this is a starter skeleton package. You don't need to adopt changes made in existing apps. Just re-add the api guard to your auth config. |
My comment refers only for Package Development and CI integration testing with protected function getEnvironmentSetUp($app) {
$app['config']->set('auth.guards.api', [
'driver' => 'passport',
'provider' => 'users',
]);
} More context I'm developing app with independent packages. If in you package you have in composer.json
and have been using With no change in code our CI/CD 2 days ago throwed an error Like you @driesvints mentioned for the standard app development this is not a case at all, just packages. PS. I'm going to change |
Hi @qunabu I intentionally sync the Laravel changes and release them as breaking changes to ensure that every packages depending on What you need to do as a package developer: 1. My package explicitly use
|
@qunabu I completely agree with you. We're facing the same problem and our packages CI/CD are failing for no reason. @crynobone I think you are missing the point here. this change in this PR will only affect the new projects created by this skeleton. But your |
I couldn't find this information can you point me out where is it. Thanks for clarifying. |
This PR serves as a proof of concept for what it would look like to just make Sanctum the default API authentication stack in a new Laravel application.
Motivations: The
token
driver is not robust and is no longer documented as of the Laravel 8.x release many months ago. As in, there is literally no documentation on the website about how to use it because I simply don't think it is a good idea to ever use it.