Laravel get user info by Jwt token

I’m using laravel as my backend.
Once the user has logged into my app, all I have is just a token without any information regards the username or any other user details.

Once I retrive the JWT Token and store it in my frontend (angular2), how I can get the user details?

For the record, i’m using the following laravel library:
https://github.com/tymondesigns/jwt-auth

2
Leave a Reply

avatar
2 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Jason
Guest

To get the user information

  1. First get the token from JWTAuth like this:

    $token = JWTAuth::getToken();

  2. Then get the user from the token as follows:

    $user = JWTAuth::toUser($token);

Jason
Guest

you can get user information like this way :

$user = JWTAuth::toUser(your_token_here);