This plugin hasn’t been tested with the latest 3 major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

User Data Fields For JWT Authentication


WordPress is Good Way To Build Websites , But It Will Be Better If Build Android and Ios Apps For Your Websites
Now With Rest Api You Can Create Posts , Edit Posts , View Posts , Users , Create Users , Upload Media etc..

But one of the things you may need that Wp Rest Api doesn’t provide is the Authentication System ( Login User )
You Have To Use Jwt Plugin

And This Plugin Is Useful If You Don’t Want To Make Another Request To Fetch User Data Like Id etc..
Because You Have To Get The Id Of The User To Get All Data On External Apps Like Mobile Apps
And You Should Make Requests To results to those matching a string
But With This Plugin It Make More Easy And Faster
It Really Simple Plugin
It Writed With 50 Lines Of Code , The Size Of The Plugin Is 3Kb

Note : This Is Plugin For

So If Jwt Authentication Plugin Is Not Installed
This Plugin Will Not Add The Fields To This EndPoint

And Fields Will Added Only If Getted Token Successfully

Example Request (Before Install The Plugin):
    “token”: “eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC8xOTIuMTY4LjAuMTgyIiwiaWF0IjoxNjE0MDg3NDQ2LCJuYmYiOjE2MTQwODc0NDYsImV4cCI6MTYxNDY5MjI0NiwiZGF0YSI6eyJ1c2VyIjp7ImlkIjoiMSJ9fX0.KeAUc7PiTne0_PThsSAWo1ruvl2Ocu-fbCn2jG7zkoE”,
    “user_email”: “”,
    “user_nicename”: “admin”,
    “user_display_name”: “admin”

Example Response (After Installed The Plugin):
    “token”: “eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC8xOTIuMTY4LjAuMTgyIiwiaWF0IjoxNjE0MDg2NjQyLCJuYmYiOjE2MTQwODY2NDIsImV4cCI6MTYxNDY5MTQ0MiwiZGF0YSI6eyJ1c2VyIjp7ImlkIjoiMSJ9fX0.nyDOICdQcZKbWZo2kQRp_eLBkuxjnK_rpxs-HJREyCg”,
    “user_email”: “”,
    “user_nicename”: “admin”,
    “user_display_name”: “admin”,
    “user_id”: 1,
    “user_login”: “admin”,
    “user_first_name”: “sfd”,
    “user_last_name”: “”,
    “user_roles”: [
    “user_role”: “administrator”,
    “user_registered”: “2021-02-17 09:21:29”,
    “user_url”: “http://localhost”,
    “user_status”: “0”,
    “user_avatar_url”: “”,
    “user_activation_key”: “”

You Can Add The Code Of This Plugin To Your Function.php
But This Not Recommended Because When You Change The Theme Or Update It
The Code Will Removed

Don’t Forget To Setup Jwt Plugin

Can Add User Data Fields To Validate Token Endpoint ?

This Plugin Also Can Add User Data Fields To Validate Token Endpoint
Unfortunately, the jwt extension does not support using the filter for validate_token function,
So You Will Need To Modify Some Codes Inside Jwt Plugin Codes
Go To \wp-content\plugins\jwt-authentication-for-wp-rest-api\public\class-jwt-auth-public.php
And At The End Of Function That Named validate_token
In Line 302

Edit This Code
From :
/** If the output is true return an answer to the request to show it */
return array(
‘code’ => ‘jwt_auth_valid_token’,
‘data’ => array(
‘status’ => 200,
To :
$value = array(
‘code’ => ‘jwt_auth_valid_token’,
‘data’ => array(
‘status’ => 200,
/** If the output is true return an answer to the request to show it */
return apply_filters(‘jwt_auth_validate_token’, $value, $token);

Now You Have Done
The Plugin Will Able To Add New Values by adding a filter
Note :
If You Updated The Jwt Plugin
You Should Again Edit The Code Because It Will Removed


JWT Authentication for WP REST API


  • This is When Get Token Response
  • This Is When Get Validate Token Response


How To Use This Plugin ?

Just Install It To Your WordPress Site , And No Another Action Required , But If You Want Add The User Fields To Validate Token Please Make Sure That You Have Edit Required Code In Jwt Plugin , Please Read Description For More Information


Read all 3 reviews

Contributors & Developers

“User Data Fields For JWT Authentication” adalah perisian sumber terbuka. Orang-orang berikut telah menyumbang kepada pemalam ini.