CoCart – JWT Authentication

CoCart – JWT Authentication Install Statistics

-12
0%
Today: 0 Yesterday: 12 All-time: 983 downloads
CoCart – JWT Authentication Icon

Try plugin: CoCart – JWT Authentication

We'll create fresh WordPress site with CoCart – JWT Authentication installed. You have 20 minutes to test the plugin after that site we'll be deleted.

Takes ~10 seconds to install.

About CoCart – JWT Authentication

JWT Authentication for CoCart.

0


0


0


0


0

updated: 1 year ago
since: 1 year ago

Description

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.