Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Laravel 11 causes 401 issues when using stateful domains #503

Closed
likeadeckofcards opened this issue Mar 20, 2024 · 1 comment
Closed

Comments

@likeadeckofcards
Copy link

Sanctum Version

4.0.0

Laravel Version

11.0.7

PHP Version

8.2

Database Driver & Version

MySQL

Description

When updating to Laravel 11, if you remove the app config file but leave the sanctum file the call to Sanctum::currentApplicationUrlWithPort() will cause the underlying fetch of config('app.url') will result in a null value being returned.

So far I have found 2 workarounds:

  1. Remove the sanctum.php or at least remove the definition of stateful from the file.
  2. Make sure to define the SANCTUM_STATEFUL_DOMAINS in the env file.

Steps To Reproduce

  1. Upgrade from Laravel 10 to Laravel 11.
  2. Remove the app.php config file (If you use Laravel Shift, this is done for you)
  3. Try opening the app using stateful domains without defining SANCTUM_STATEFUL_DOMAINS in the .env file
@driesvints
Copy link
Member

if you remove the app config file

We don't officially support removing this file. Just leave it in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants