Skip to content

Conversation

@hafezdivandari
Copy link
Contributor

@hafezdivandari hafezdivandari commented Sep 15, 2025

Fixes #1851

The request created in \Laravel\Passport\PersonalAccessTokenFactory is a dummy, and its URI is not important. However, when trusted hosts are configured, \Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory::createRequest() calls \Symfony\Component\HttpFoundation\Request::getHost(), which validates the trusted hosts and causes an exception to be thrown.

This PR resolves the exception thrown when issuing Personal Access Tokens with configured trusted hosts.

@github-actions
Copy link

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@hafezdivandari hafezdivandari marked this pull request as ready for review September 15, 2025 20:24
@taylorotwell taylorotwell merged commit 8152e79 into laravel:13.x Sep 15, 2025
10 checks passed
@hafezdivandari hafezdivandari deleted the 13.x-fix-pat-with-trusted-hosts branch September 15, 2025 21:19
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

Successfully merging this pull request may close these issues.

Untrusted host from PersonalAccessTokenFactory

2 participants