mikenicholson / passport-jwt

Passport authentication using JSON Web Tokens
MIT License
1.96k stars 213 forks source link

Including data into token #137

Closed lfernando-silva closed 6 years ago

lfernando-silva commented 6 years ago

How can I insert some more information into JWT response? For example, include the name and email of logged user, just to show it in a fixed bar, avoiding to make a new request on the frontend just to take it. And on JWT decode, to obtain something like:

{
  "userId": 2,
 "name": "john",
 "loginUser":"johndoe42",
  "iat": 1511030741,
  "exp": 1511117141,
  "aud": "0.0.0.0",
  "iss": "feathers",
  "sub": "anonymous"
}
lfernando-silva commented 6 years ago

Sorry, my mistake, it is actually a issue using Feathers Authentication