sanctum.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. use Laravel\Sanctum\Sanctum;
  3. return [
  4. /*
  5. |--------------------------------------------------------------------------
  6. | Stateful Domains
  7. |--------------------------------------------------------------------------
  8. |
  9. | Requests from the following domains / hosts will receive stateful API
  10. | authentication cookies. Typically, these should include your local
  11. | and production domains which access your API via a frontend SPA.
  12. |
  13. */
  14. 'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
  15. '%s%s',
  16. 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
  17. '',
  18. // Sanctum::currentApplicationUrlWithPort()
  19. ))),
  20. /*
  21. |--------------------------------------------------------------------------
  22. | Sanctum Guards
  23. |--------------------------------------------------------------------------
  24. |
  25. | This array contains the authentication guards that will be checked when
  26. | Sanctum is trying to authenticate a request. If none of these guards
  27. | are able to authenticate the request, Sanctum will use the bearer
  28. | token that's present on an incoming request for authentication.
  29. |
  30. */
  31. 'guard' => ['web'],
  32. /*
  33. |--------------------------------------------------------------------------
  34. | Expiration Minutes
  35. |--------------------------------------------------------------------------
  36. |
  37. | This value controls the number of minutes until an issued token will be
  38. | considered expired. This will override any values set in the token's
  39. | "expires_at" attribute, but first-party sessions are not affected.
  40. |
  41. */
  42. 'expiration' => env("TOKEN_EXPIRATION", 2 * 30 * 24 * 60),
  43. /*
  44. |--------------------------------------------------------------------------
  45. | Token Prefix
  46. |--------------------------------------------------------------------------
  47. |
  48. | Sanctum can prefix new tokens in order to take advantage of numerous
  49. | security scanning initiatives maintained by open source platforms
  50. | that notify developers if they commit tokens into repositories.
  51. |
  52. | See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
  53. |
  54. */
  55. 'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
  56. /*
  57. |--------------------------------------------------------------------------
  58. | Sanctum Middleware
  59. |--------------------------------------------------------------------------
  60. |
  61. | When authenticating your first-party SPA with Sanctum you may need to
  62. | customize some of the middleware Sanctum uses while processing the
  63. | request. You may change the middleware listed below as required.
  64. |
  65. */
  66. 'middleware' => [
  67. 'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
  68. 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
  69. 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
  70. ],
  71. ];