Tmeister / wp-api-jwt-auth

A simple plugin to add JSON Web Token (JWT) Authentication to WP REST API
GNU General Public License v2.0
549 stars 159 forks source link

Can you add an option to get the user id when we get jwt token #231

Closed elmcapp closed 1 year ago

elmcapp commented 2 years ago

If we run a post request to generate token we get the follow: (/wp-json/jwt-auth/v1/token)

  1. token
  2. user email
  3. user nicename
  4. user display name

Can you please also provide the ID.
When I look in the class file I found the follow

        'token' => $token,
        'user_email' => $user->data->user_email,
        'user_nicename' => $user->data->user_nicename,
        'user_display_name' => $user->data->display_name,

I was able to add 'user_id' => $user->data->ID.

The problem is that every time the plugin updates or I reinstall the plugin I have to keep adding the line of code. Can you please add it in permanently

Tmeister commented 1 year ago

You can add more information on the response using the jwt_auth_token_before_sign here.