CoCart – JWT Authentication

CoCart – JWT Authentication

Wordpress plugin

Install on Wordpress

App Details

This free add-on for CoCart allows you to authenticate via a simple JWT Token.

★★★★★

An excellent plugin, which makes building a headless WooCommerce experience a breeze. Easy to use, nearly zero setup time. Harald Schneider

Enable PHP HTTP Authorization Header

🖥️ Shared Hosts

Most shared hosts have disabled the HTTP Authorization Header by default.

To enable this option you’ll need to edit your .htaccess file by adding the following:

RewriteEngine on RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1] 

or

RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 

WPEngine

To enable this option you’ll need to edit your .htaccess file by adding the following (see this issue):

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 

🧰 Configuration

  1. Set a unique secret key in your wp-config.php file defined to COCART_JWT_AUTH_SECRET_KEY.
  2. Install and activate plugin.

Token Expiration

By default, the token expires after two full days but can be filtered to change to your preference using this hook cocart_jwt_auth_expire.

Here is an example changing it to expire after just 2 hours.

add_filter( 'cocart_jwt_auth_expire', function() { return MINUTE_IN_SECONDS * 120 }); 

📄 Usage

  1. Authenticate via basic method with the login endpoint to get your token.
  2. Store the given token under jwt_token in your application.
  3. Now authenticate any cart route with Bearer authentication with the token given.

★★★★★

Amazing Plugin. I’m using it to create a react-native app with WooCommerce as back-end. This plugin is a life-saver! Daniel Loureiro

🧰 Tools and Libraries

  • CoCart Beta Tester allows you to easily update to prerelease versions of CoCart Lite for testing and development purposes.
  • CoCart VSCode extension for Visual Studio Code adds snippets and autocompletion of functions, classes and hooks.
  • CoCart Product Support Boilerplate provides a basic boilerplate for supporting a different product types to add to the cart with validation including adding your own parameters.
  • CoCart Cart Callback Example provides you an example of registering a callback that can be triggered when updating the cart.
  • CoCart Tweaks provides a starting point for developers to tweak CoCart to their needs.

👍 Add-ons to further enhance CoCart

We also have other add-ons that extend CoCart to enhance your development and your customers shopping experience.

They work with the FREE version of CoCart already, and these add-ons of course come with support too.

⌨️ Join our growing community

A Discord community for developers, WordPress agencies and shop owners building the fastest and best headless WooCommerce stores with CoCart.

Join our community

🐞 Bug reports

Bug reports for CoCart – JWT Authentication are welcomed in the CoCart – JWT Authentication repository on GitHub. Please note that GitHub is not a support forum, and that issues that aren’t properly qualified as bugs will be closed.

More information

💯 Credits

This plugin is created by Sébastien Dumont.

Pricing

Starting from $0 per month.

Check Out the Contact Form Widget

By Common Ninja

Contact FormTry For Free!

App Info

Rating

Reviewers

No reviews

Tags

cart
json web token
jwt
jwt auth
woocommerce

Developed By

CoCart Headless

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.

Contact Form for Wordpress logo

Contact Form

Use a contact form so visitors can send messages, submit inquiries, and help you collect leads and improve user experience.

Course Registration Form for Wordpress logo

Course Registration Form

Use a scroll progress bar that visually tracks reading on the page, improves navigation, and keeps visitors aware of their position.

Feature Voting for Wordpress logo

Feature Voting

Use feature voting so users submit ideas, vote on requests, and help you prioritize product updates by real customer demand.

Tumblr Feed for Wordpress logo

Tumblr Feed

Show Tumblr posts with a Tumblr feed that keeps content fresh, improves navigation, and helps visitors discover more posts.

Scroll to Element Button for Wordpress logo

Scroll to Element Button

Scroll to element button that improves navigation by letting visitors jump directly to key sections, reducing friction and boosting overall engagement.

Reviews Trust Box for Wordpress logo

Reviews Trust Box

Display ratings from multiple platforms in a reviews trust box that builds credibility, social proof, and boosts conversions.

Yelp Reviews for Wordpress logo

Yelp Reviews

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

Bluesky Feed Slider for Wordpress logo

Bluesky Feed Slider

Show Bluesky posts with a Bluesky feed slider that scrolls updates and keeps content visible while keeping visitors engaged.

News Ticker for Wordpress logo

News Ticker

Use a news ticker to display headlines and updates that highlight key information and keep users informed in real time.

Virtual Tour for Wordpress logo

Virtual Tour

Create immersive 360 virtual tours with interactive hotspots that let visitors explore spaces, view details clearly, and experience panoramic environments seamlessly.

Card Builder for Wordpress logo

Card Builder

Add customizable content cards to your site to display structured information clearly with flexible layout and design options.

Audio Player for Wordpress logo

Audio Player

Add a no-code audio player to your site and boost engagement with music, podcasts, and voice content effortlessly.

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