Skip to content

Commit da16b49

Browse files
Documents changes in laravel/sanctum#564 (#10350)
* Documents changes in laravel/sanctum#564 Adds documentation to the Sanctum helper functions. * Update sanctum.md --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent b3927f9 commit da16b49

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sanctum.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ For this feature, Sanctum does not use tokens of any kind. Instead, Sanctum uses
280280

281281
First, you should configure which domains your SPA will be making requests from. You may configure these domains using the `stateful` configuration option in your `sanctum` configuration file. This configuration setting determines which domains will maintain "stateful" authentication using Laravel session cookies when making requests to your API.
282282

283+
To assist you in setting up your first-party stateful domains, Sanctum provides two helper functions that you can include in the configuration. First, `Sanctum::currentApplicationUrlWithPort()` will return the current application URL from the `APP_URL` environment variable, and `Sanctum::currentRequestHost()` will inject a placeholder into the stateful domain list which, at runtime, will be replaced by the host from the current request so that all requests with the same domain are considered stateful.
284+
283285
> [!WARNING]
284286
> If you are accessing your application via a URL that includes a port (`127.0.0.1:8000`), you should ensure that you include the port number with the domain.
285287

0 commit comments

Comments
 (0)