Skip to content

Hash token guard credentials during validation#59582

Closed
Nipun404 wants to merge 1 commit intolaravel:13.xfrom
Nipun404:fix-token-guard-validate-hashed-token
Closed

Hash token guard credentials during validation#59582
Nipun404 wants to merge 1 commit intolaravel:13.xfrom
Nipun404:fix-token-guard-validate-hashed-token

Conversation

@Nipun404
Copy link
Copy Markdown
Contributor

@Nipun404 Nipun404 commented Apr 7, 2026

This pull request updates TokenGuard::validate to respect hashed token storage.

TokenGuard::user already hashes the incoming token before retrieving the user when the guard is configured with hashed token storage. However, TokenGuard::validate was passing the raw token to the user provider, which caused validation to fail for valid plain-text tokens when the stored API token is hashed.

This change makes validate use the same hashing behavior as user.

A regression test has been added to verify that hashed token validation passes the hashed credential value to the user provider.

@taylorotwell
Copy link
Copy Markdown
Member

I am closing this pull request because it lacks sufficient explanation, tests, or both. It is difficult for us to merge pull requests without these things because the change may introduce breaking changes to the framework.

Feel free to re-submit your change with a thorough explanation of the feature and tests - integration tests are preferred over unit tests. Please include it's benefit to end users; the reasons it does not break any existing features; how it makes building web applications easier, etc.

Thanks!

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.

2 participants