vahidvdn
1 month ago
296
9
Laravel

$request->user() is fetching user data from db instead of token

Posted 1 month ago by vahidvdn

I have a token (generated with Laravel passport) in my header while sending a request. When I want to extract data from the token, I have the following:

$request->user();

But this retrieves the data from the db (because when I change the name value, it gives me the new name), which is not a good idea. (since the goal of jwt is extract the data form the token itself and be stateless).

Please sign in or create an account to participate in this conversation.