-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JWT Authentication for WP REST API By Enrique Chavez, Not work #9
Comments
Hey @hadi-aj I don't fully understand what you mean that CoCart does not define I've had a mix of feedback with this plugin where it works and does not. Mostly due to not setting up authentication headers to be approved. I think I might be dropping support for this plugin as I have my own JWT plugin specifically for CoCart. Last CoCart update v3.8.1 was to support it. But if you can find where Thank you for reporting the issue. |
Hi I defined this constant in the Thank you for your awesome plugin. |
@hadi-aj Yes WordPress defines If you define REST_REQUEST when CoCart is setting up constants then WordPress is going to assume your doing a REST API request all the time which will not help you. I think the issue is not defining again WooCommerce hooks at priority |
Yes you are right. We should not define After about 10 hours debugging, I think I found the problem, in the I moved this method to the
|
I already said it's a load order of |
Completely forgot this issue was still open. Just tested the JWT plugin and it works with no changes made where you suggested. Closing for now. |
Prerequisites
Describe the bug
Hi
I use the JWT Authentication for WP REST API plugin to authenticate users. This plugin initially examines that the
REST_REQUEST
is defined, otherwise it will not perform validation.REST_REQUEST
constant is defined in WordPress and Woocommers, but not in Cocart.Expected behavior
Authenticate users!
Actual behavior
Not Authenticate users!
Steps to reproduce
/wp-json/jwt-auth/v1/token
./wp-json/cocart/v2/cart/add-item
with token to add an item to cart./wp-json/cocart/v2/cart
to get cart items.Items is Empty.
WordPress Environment
`
WordPress Environment
WordPress address (URL):
Site address (URL):
WC Version:
REST API Version: ✔ 7.7.1
WC Blocks Version: ✔ 10.0.5
Action Scheduler Version: ✔ 3.5.4
Log Directory Writable: ❌ To allow logging
make writable or define a custom WC_LOG_DIR.
WP Version:
WP Multisite: –
WP Memory Limit: ❌ - We recommend setting memory to at least 64MB. See: Increasing memory allocated to PHP
WP Debug Mode: –
WP Cron: –
Language:
External object cache: –
Server Environment
Server Info:
PHP Version: - ❌ WooCommerce will run under this version of PHP
however
some features such as geolocation are not compatible. Support for this version will be dropped in the next major release. We recommend using PHP version 7.2 or above for greater performance and security. How to update your PHP version
PHP Post Max Size:
PHP Time Limit:
PHP Max Input Vars:
cURL Version:
SUHOSIN Installed: –
Max Upload Size:
Default Timezone is UTC: ❌ Default timezone is - it should be UTC
fsockopen/cURL: ❌ Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.
SoapClient: ❌ Your server does not have the SoapClient class enabled - some gateway plugins which use SOAP may not work as expected.
DOMDocument: ❌ Your server does not have the DOMDocument class enabled - HTML/Multipart emails
and also some extensions
will not work without DOMDocument.
GZip: ❌ Your server does not support the gzopen function - this is required to use the GeoIP database from MaxMind.
Multibyte String: ❌ Your server does not support the mbstring functions - this is required for better character encoding. Some fallbacks will be used instead for it.
Remote Post: ❌ wp_remote_post() failed. Contact your hosting provider.
Remote Get: ❌ wp_remote_get() failed. Contact your hosting provider.
Database
WC Database Version:
WC Database Prefix:
Database information:: Unable to retrieve database information. Usually
this is not a problem
and it only means that your install is using a class that replaces the WordPress database class (e.g.
HyperDB) and WooCommerce is unable to get database information.
Security
Secure connection (HTTPS): ❌
Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.
Hide errors from visitors: ❌Error messages should not be shown to visitors.
Active Plugins (0)
Inactive Plugins (0)
Settings
API Enabled: –
Force SSL: –
Currency: ()
Currency Position:
Thousand Separator:
Decimal Separator:
Number of Decimals:
Taxonomies: Product Types:
Taxonomies: Product Visibility:
Connected to WooCommerce.com: –
Enforce Approved Product Download Directories: –
HPOS feature screen enabled: –
HPOS feature enabled: –
Order datastore:
HPOS data sync enabled: –
WC Pages
Theme
Name:
Version:
Author URL:
Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme
WooCommerce Support: ❌ Not declared
Templates
Overrides: –
Admin
Enabled Features: activity-panels
analytics
coupons
customer-effort-score-tracks
import-products-task
experimental-fashion-sample-products
shipping-smart-defaults
shipping-setting-tour
homescreen
marketing
mobile-app-banner
navigation
onboarding
onboarding-tasks
remote-inbox-notifications
remote-free-extensions
payment-gateway-suggestions
shipping-label-banner
subscriptions
store-alerts
transient-notices
woo-mobile-welcome
wc-pay-promotion
wc-pay-welcome-page
Disabled Features: product-block-editor
minified-js
new-product-management-experience
product-variation-management
settings
Daily Cron: ✔ Next scheduled: 2023-06-20 05:18:10 +00:00
Options: ✔
Notes: 83
Onboarding: completed
Action Scheduler
Complete: 113
Oldest: 2023-05-22 10:15:30 +0000
Newest: 2023-06-19 15:32:13 +0000
Failed: 10
Oldest: 2023-04-03 05:25:10 +0000
Newest: 2023-06-06 20:01:55 +0000
Pending: 3
Oldest: 2023-06-20 13:31:02 +0000
Newest: 2023-06-20 13:31:02 +0000
CoCart
Version: 3.8.1
Database Version: 3.8.1
Install Date: May 28
2023
Carts in Session: 40
Carts Active: 40 out of 40 in session.
Carts Expiring Soon: 0 out of 40 in session.
Carts Expired: 0 out of 40 in session.
Carts Source (by CoCart): 38
Carts Source (by Web): 2
Carts Source (by Other): 0
Status report information
Generated at: 2023-06-19 17:15:24 +00:00
`
Isolating the problem
The text was updated successfully, but these errors were encountered: