Laravel Authentication 13

Last reviewed Sep 20, 2026

Export as PDF

Prompt Details

Prompt Composition

3prompts
  1. PHP 8.5145 lines · 5.4K tokens
  2. Laravel 1368 lines · 2.4K tokens
  3. Laravel Authentication 1383 lines · 3.8K tokens
Total296 lines · 11.6K tokens

CWE Coverage

  • 20
  • 22
  • 59
  • 78
  • 79
  • 88
  • 89
  • 93
  • 95
  • 98
  • 117
  • 187
  • 201
  • 203
  • 208
  • 209
  • 214
  • 256
  • 294
  • 295
  • 307
  • 312
  • 323
  • 338
  • 340
  • 347
  • 352
  • 354
  • 362
  • 367
  • 384
  • 390
  • 409
  • 434
  • 470
  • 502
  • 521
  • 522
  • 532
  • 552
  • 601
  • 611
  • 613
  • 614
  • 620
  • 639
  • 640
  • 674
  • 732
  • 770
  • 776
  • 798
  • 807
  • 829
  • 837
  • 862
  • 863
  • 915
  • 916
  • 918
  • 940
  • 942
  • 1004
  • 1275
  • 1333
  • 1395

Prompt Preview

Apply the Laravel 13 prompt first. These additional rules cover guards, providers, password recovery, email verification, policy bypasses, and optional Fortify, Sanctum, and Socialite integrations. Apply package-specific rules only when that package is used.

Guards and credential decisions

  • Bind each route to its intended guard with auth:<guard> and resolve the user through that guard. Align config/auth.php providers with fortify.guard and fortify.passwords; Fortify requires a StatefulGuard. Never select guards or providers from arbitrary request input.
  • Pass an explicit credential allowlist to Auth::attempt() with the submitted plaintext password; add account-status or tenant conditions from trusted server state, or use attemptWhen(). Do not pass the entire request as credentials or pre-hash the submitted password.
  • Enforce account disablement and tenant membership on authenticated requests as well as password login. Session restoration, remember-me authentication, Sanctum tokens, and passkey login do not rerun the conditions supplied to attempt().
  • Restrict Auth::login(), loginUsingId(), onceUsingId(), and setUser() to identities established by a trusted authentication or authorized impersonation flow; these APIs do not verify a password or complete MFA. An identifier or a retrieved user model is insufficient proof.
  • Keep custom UserProvider::retrieveByCredentials() separate from validateCredentials(), and implement rehashPasswordIfRequired(). A Fortify::authenticateUsing() callback must verify credentials and account