sanctum.php 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. Sanctum::currentApplicationUrlWithPort()
  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. | Refresh Token Expiration Minutes
  45. |--------------------------------------------------------------------------
  46. |
  47. | This value controls the number of minutes until an issued refresh
  48. | token cookie will be considered expired.
  49. |
  50. */
  51. 'rt_expiration' => 129600, // 90 days in minutes (90 * 24 * 60)
  52. /*
  53. |--------------------------------------------------------------------------
  54. | Token Prefix
  55. |--------------------------------------------------------------------------
  56. |
  57. | Sanctum can prefix new tokens in order to take advantage of numerous
  58. | security scanning initiatives maintained by open source platforms
  59. | that notify developers if they commit tokens into repositories.
  60. |
  61. | See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
  62. |
  63. */
  64. 'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
  65. /*
  66. |--------------------------------------------------------------------------
  67. | Sanctum Middleware
  68. |--------------------------------------------------------------------------
  69. |
  70. | When authenticating your first-party SPA with Sanctum you may need to
  71. | customize some of the middleware Sanctum uses while processing the
  72. | request. You may change the middleware listed below as required.
  73. |
  74. */
  75. 'middleware' => [
  76. 'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
  77. 'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class,
  78. 'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
  79. ],
  80. ];