Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The AuthenticateSession middleware assumes that the user has a password #478

Closed
nhedger opened this issue Nov 22, 2023 · 2 comments
Closed

Comments

@nhedger
Copy link
Contributor

nhedger commented Nov 22, 2023

Sanctum Version

3.3.2

Laravel Version

10.33

PHP Version

8.2

Database Driver & Version

No response

Description

The AuthenticateSession middleware introduced in pull request #467 assumes that the user has a password, which may not always be the case. Think passwordless logins.

Happy to contribute a fix if you're down.

Steps To Reproduce

n/a

@crynobone
Copy link
Member

I believe the AuthenticateSession is only meant for application where user has a password and you can disable it by setting it to null from sanctum.php config file:

'middleware' => [
-   'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
+   'authenticate_session' => null,
    'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
    'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
],

@nhedger
Copy link
Contributor Author

nhedger commented Nov 23, 2023

Thanks, I'll it this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants