You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
How to retrieve the User session after login?
I am building API using this plugin to handle the authentication.
How do I get the logged user session?
I tried the usual
$user = Auth::getUser();
but it does not work
thanks
The text was updated successfully, but these errors were encountered:
From your question I see you need just User model instance not user's session. To achieve this you need to get user's id from token and then get the model:
$user_id = JWTAuth::authenticate($token)->id;
// or
$user_id = JWTAuth::parseToken()->authenticate()->id;
// then
$model = UserModel::findOrFail($user_id);
Hi,
How to retrieve the User session after login?
I am building API using this plugin to handle the authentication.
How do I get the logged user session?
I tried the usual
but it does not work
thanks
The text was updated successfully, but these errors were encountered: