sanctum.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. return [
  3. /*
  4. |--------------------------------------------------------------------------
  5. | Stateful Domains
  6. |--------------------------------------------------------------------------
  7. |
  8. | Requests from the following domains / hosts will receive stateful API
  9. | authentication cookies. Typically, these should include your local
  10. | and production domains which access your API via a frontend SPA.
  11. |
  12. */
  13. 'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
  14. '%s%s%s',
  15. 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
  16. env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : '',
  17. env('FRONTEND_URL') ? ','.parse_url(env('FRONTEND_URL'), PHP_URL_HOST) : ''
  18. ))),
  19. /*
  20. |--------------------------------------------------------------------------
  21. | Sanctum Guards
  22. |--------------------------------------------------------------------------
  23. |
  24. | This array contains the authentication guards that will be checked when
  25. | Sanctum is trying to authenticate a request. If none of these guards
  26. | are able to authenticate the request, Sanctum will use the bearer
  27. | token that's present on an incoming request for authentication.
  28. |
  29. */
  30. 'guard' => ['web'],
  31. /*
  32. |--------------------------------------------------------------------------
  33. | Expiration Minutes
  34. |--------------------------------------------------------------------------
  35. |
  36. | This value controls the number of minutes until an issued token will be
  37. | considered expired. This will override any values set in the token's
  38. | "expires_at" attribute, but first-party sessions are not affected.
  39. |
  40. */
  41. 'expiration' => null,
  42. /*
  43. |--------------------------------------------------------------------------
  44. | Sanctum Middleware
  45. |--------------------------------------------------------------------------
  46. |
  47. | When authenticating your first-party SPA with Sanctum you may need to
  48. | customize some of the middleware Sanctum uses while processing the
  49. | request. You may change the middleware listed below as required.
  50. |
  51. */
  52. 'middleware' => [
  53. 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
  54. 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
  55. ],
  56. ];