Skip to content

Membersync issue jwt token #21

@ethelynmatias

Description

@ethelynmatias

Issues

$token = JWT::decode( $token, $secret_key, [ 'HS256' ] );

if (!is_array($allowed_algs) || !in_array($header->alg, $allowed_algs)) {

Cause of Issue
Because WooCommerce loads analytics routes:
/wp-json/wc-analytics/reports/*

MemberSync plugin error
PHP Fatal error: Uncaught DomainException: Algorithm not allowed in /nas/content/live/igns/wp-content/plugins/memberdash/vendor/tangible/framework/api/rest/jwt.php:80#012Stack trace:#012#0 /nas/content/live/igns/wp-content/plugins/memberdash/vendor/tangible/framework/api/rest/routes.php(257): tangible\api\JWT::decode('eyJraWQiOiIyTEN...', '#?re%lU6&UPZ/y%...', Array)#012#1 /nas/content/live/igns/wp-content/plugins/memberdash/vendor/tangible/framework/api/rest/routes.php(198): class@anonymous->validate_token(false)#012#2 /nas/content/live/igns/wp-content/plugins/memberdash/vendor/tangible/framework/api/rest/routes.php(490): class@anonymous->determine_current_user()#012#3 /nas/content/live/igns/wp-includes/class-wp-hook.php(341): class@anonymous->rest_pre_dispatch(NULL, Object(WP_REST_Server), Object(WP_REST_Request))#012#4 /nas/content/live/igns/wp-includes/plugin.php(205): WP_Hook->apply_filters(NULL, Array)#012#5 /nas/content/live/igns/wp-includes/rest-api/class-wp-rest-server.php(1078): apply_filters('rest_pre_dispat...', NULL, Object(WP_REST_Server), Object(WP_REST_Request))#012#6 /nas/content/live/igns/wp-includes/rest-api.php(594): WP_REST_Server->dispatch(Object(WP_REST_Request))#012#7 /nas/content/live/igns/wp-content/plugins/woocommerce/src/Admin/API/Reports/PerformanceIndicators/Controller.php(139): rest_do_request(Object(WP_REST_Request))#012#8 /nas/content/live/igns/wp-content/plugins/woocommerce/src/Admin/API/Reports/PerformanceIndicators/Controller.php(274): Automattic\WooCommerce\Admin\API\Reports\PerformanceIndicators\Controller->get_analytics_report_data()#012#9 /nas/content/live/igns/wp-content/plugins/woocommerce/src/Admin/API/Reports/PerformanceIndicators/Controller.php(655): Automattic\WooCommerce\Admin\API\Reports\PerformanceIndicators\Controller->get_indicator_data()#012#10 /nas/content/live/igns/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-reports-v1-controller.php(48): Automattic\WooCommerce\Admin\API\Reports\PerformanceIndicators\Controller->get_collection_params()#012#11 /nas/content/live/igns/wp-content/plugins/woocommerce/src/Admin/API/Reports/PerformanceIndicators/Controller.php(85): WC_REST_Reports_V1_Controller->register_routes()#012#12 /nas/content/live/igns/wp-content/plugins/woocommerce/src/Admin/API/Init.php(164): Automattic\WooCommerce\Admin\API\Reports\PerformanceIndicators\Controller->register_routes()#012#13 /nas/content/live/igns/wp-includes/class-wp-hook.php(341): Automattic\WooCommerce\Admin\API\Init->rest_api_init(Object(WP_REST_Server))#012#14 /nas/content/live/igns/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array)#012#15 /nas/content/live/igns/wp-includes/plugin.php(522): WP_Hook->do_action(Array)#012#16 /nas/content/live/igns/wp-includes/rest-api.php(636): do_action('rest_api_init', Object(WP_REST_Server))#012#17 /nas/content/live/igns/wp-includes/rest-api.php(460): rest_get_server()#012#18 /nas/content/live/igns/wp-includes/class-wp-hook.php(341): rest_api_loaded(Object(WP))#012#19 /nas/content/live/igns/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array)#012#20 /nas/content/live/igns/wp-includes/plugin.php(570): WP_Hook->do_action(Array)#012#21 /nas/content/live/igns/wp-includes/class-wp.php(418): do_action_ref_array('parse_request', Array)#012#22 /nas/content/live/igns/wp-includes/class-wp.php(821): WP->parse_request('')#012#23 /nas/content/live/igns/wp-includes/functions.php(1343): WP->main('')#012#24 /nas/content/live/igns/wp-blog-header.php(16): wp()#012#25 /nas/content/live/igns/index.php(17): require('/nas/content/li...')#012#26 {main}#012 thrown in /nas/content/live/igns/wp-content/plugins/memberdash/vendor/tangible/framework/api/rest/jwt.php on line 80

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions