How to obtain user information after authentication with jwt-auth in Ravel 5.5

Asked 1 years ago, Updated 1 years ago, 95 views

Ravel 5.5 uses jwt-auth to make api.
Based on the information obtained by searching, I have obtained user information after authentication by using the me method to the controller. If this is the case, I will probably get information from DB every time from the sub user id obtained from the token $claims.(I couldn't keep up with the source because of my skills.)
I'm thinking of creating SNS, but I don't ask DB for user information every time I transition.
I want to keep the credentials in Redis and files.

Like login authentication using normal session instead of api
How do I get user information without accessing DB in getUser()? Isn't it possible to use jwt-auth?
Or, you don't have to worry about that. If you use the query cache, even if there are many active users, will there be no problem with the burden of obtaining user information?
For example, 1000 concurrent users.

I would appreciate it if you could teach me.
Thank you for your cooperation.

public function me()
{
    return response()->json(auth()->user());
}

laravel-5 jwt

2022-09-29 22:35

1 Answers

I'm afraid of using it without knowing it, so I ended up making my own.


2022-09-29 22:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.