User Data Fields For JWT Authentication

User Data Fields For JWT Authentication

Wordpress plugin

Install on Wordpress

App Details

WordPress is a good content mangement system for building websites, but it will be better if you build like mobile apps,
With the wordpress rest api you can create posts, edit posts, view posts, Users, Uploading Media etc…
but the problem with the wordpress rest api it does not provide any authentication methods for third party application like mobile apps
The Jwt Plugin on wordpress.org does provide that

and this plugin is just a addon for that plugin

So 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 in ordet to get all data

It really simple plugin
it writed with 50 lines of code, the size of the plugin is 3Kb

Note: This Is Plugin For
JWT Authentication for WP REST API Plugin

so if the jwt authentication plugin is not installed
this plugin will not add the fields to it endpoints

and the fields will be added only if the token is getted successfully

Example request (before install the plugin):
{
“token”: “eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC8xOTIuMTY4LjAuMTgyIiwiaWF0IjoxNjE0MDg3NDQ2LCJuYmYiOjE2MTQwODc0NDYsImV4cCI6MTYxNDY5MjI0NiwiZGF0YSI6eyJ1c2VyIjp7ImlkIjoiMSJ9fX0.KeAUc7PiTne0_PThsSAWo1ruvl2Ocu-fbCn2jG7zkoE”,
“user_email”: “[email protected]”,
“user_nicename”: “admin”,
“user_display_name”: “admin”
}

Example response (after install the plugin):
{
“token”: “eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC8xOTIuMTY4LjAuMTgyIiwiaWF0IjoxNjE0MDg2NjQyLCJuYmYiOjE2MTQwODY2NDIsImV4cCI6MTYxNDY5MTQ0MiwiZGF0YSI6eyJ1c2VyIjp7ImlkIjoiMSJ9fX0.nyDOICdQcZKbWZo2kQRp_eLBkuxjnK_rpxs-HJREyCg”,
“user_email”: “[email protected]”,
“user_nicename”: “admin”,
“user_display_name”: “admin”,
“user_id”: 1,
“user_login”: “admin”,
“user_first_name”: “sfd”,
“user_last_name”: “”,
“user_roles”: [
“administrator”
],
“user_role”: “administrator”,
“user_registered”: “2021-02-17 09:21:29”,
“user_url”: “http://localhost”,
“user_status”: “0”,
“user_avatar_url”: “https://secure.gravatar.com/avatar/22feea4605ac5b7163eac439b5241034?s=96&d=mm&r=g”,
“user_activation_key”: “”
}

Of course you can add the code of this plugin to your Theme,
but this is not recommened because when you change the theme or update it
the changes will revert back, you can create child theme for that
but instead you can just install this simple plugin

Don’t forget to setup (JwtAuthenticatonForWordpress)[https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/]

Github

Can Add User Data Fields To Validate Token Endpoint ?

This plugin can also 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 should be 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 be removed

REQUIREMENTS

JWT Authentication for WP REST API Plugin

Pricing

Starting from $0 per month.

Check Out the Announcements Widget

By Common Ninja

AnnouncementsTry For Free!

App Info

Rating

Reviewers

3 reviews

Tags

json web authentication
jwt
wp-api
wp-json

Developed By

Ahmed Hnewa

Quick & Easy

Find the Best Wordpress plugins for you

Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!

Testimonial

Testimonial plugins for Wordpress

Contact Form

Contact Form plugins for Wordpress

Maps

Maps plugins for Wordpress

Translation

Translation plugins for Wordpress

Chat

Chat plugins for Wordpress

Slider

Slider plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Contact

Contact plugins for Wordpress

Galleries

Galleries plugins for Wordpress

SEO

SEO plugins for Wordpress

Forms

Forms plugins for Wordpress

Comments

Comments plugins for Wordpress

Backup

Backup plugins for Wordpress

Privacy

Privacy plugins for Wordpress

Optimize

Optimize plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Comments

Comments plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Video Player

Video Player plugins for Wordpress

popup

popup plugins for Wordpress

SiteMap

SiteMap plugins for Wordpress

Payment

Payment plugins for Wordpress

Coming Soon

Coming Soon plugins for Wordpress

Inventory

Inventory plugins for Wordpress

Testimonials

Testimonials plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Membership

Membership plugins for Wordpress

Forms

Forms plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Sliders

Sliders plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Security

Security plugins for Wordpress

Ads

Ads plugins for Wordpress

Music Player

Music Player plugins for Wordpress

Countdown

Countdown plugins for Wordpress

Email Marketing

Email Marketing plugins for Wordpress

Membership

Membership plugins for Wordpress

Ecommerce

Ecommerce plugins for Wordpress

Customer Support

Customer Support plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Common Ninja Apps

Some of the best Common Ninja plugins for Wordpress

Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.

Announcements for Wordpress logo

Announcements

Add announcements to your site to share important updates, keep visitors informed, and guide them toward actions that support engagement and conversions.

Team Members Blobs for Wordpress logo

Team Members Blobs

Use team members blobs to present your staff in a clear, creative format that builds trust, supports transparency, and strengthens brand credibility.

Notification Popup for Wordpress logo

Notification Popup

Show alerts and updates with a notification popup that grabs attention, delivers important messages, and improves user experience.

Google Maps for Wordpress logo

Google Maps

Show business locations clearly with a Google Maps widget that displays multiple points, detailed info, and customizable styles to help visitors find you easily.

Image Poll for Wordpress logo

Image Poll

Create interactive image polls that use compelling visuals to boost engagement, gather feedback, and help visitors vote easily.

Multi-Row Image Slider for Wordpress logo

Multi-Row Image Slider

Showcase visuals with a multi row image slider that displays images in layered rows, improves design, and helps visitors explore content more easily.

Visitor Counter for Wordpress logo

Visitor Counter

Show real time visitor counts with a visitor counter widget that displays live traffic, builds social proof, and boosts engagement.

Ratio for Wordpress logo

Ratio

Create interactive infographics with a ratio widget that uses custom icons, dynamic tooltips, and clear visuals to help visitors understand data quickly.

eBay Reviews for Wordpress logo

eBay Reviews

Show eBay reviews to build trust, strengthen credibility, and help visitors make confident purchase decisions that support higher sales.

Image Gallery for Wordpress logo

Image Gallery

Showcase photos with an image gallery that displays pictures and captions in grids, improves design, and boosts visitor engagement.

Progress Circles for Wordpress logo

Progress Circles

Show progress with animated progress circles that visualize goals, display achievements, and keep visitors engaged.

RSS Feed Carousel for Wordpress logo

RSS Feed Carousel

Show RSS content with an RSS feed carousel that updates automatically, displays posts in a smooth scrolling layout, and keeps visitors engaged.

More plugins

plugins You Might Like

Discover Apps By Platform

Discover the best apps for your website

WordPress
Wix
Shopify
Weebly
Webflow
Joomla
PrestaShop
Shift4Shop
WebsiteX5
MODX
Opencart
NopCommerce

Common Ninja Search Engine

The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!

Multiple platforms