usefulteam / jwt-auth

WordPress JSON Web Token Authentication
https://wordpress.org/plugins/jwt-auth/
124 stars 50 forks source link

Problem with Dokan plugin #107

Closed gioiliop7 closed 1 year ago

gioiliop7 commented 1 year ago

Hello, i was using jwt-auth with woocommerce,dokan and everything works completely well. But when i installed the wpml plugin, the dokan is requiring header on the request and the dashboard doesn't work. Maybe be a problem with en in wp-json but i don't know. I have added dokan on whitelist but nothing worked there. Is there a solution to fix that? Is there a solution to prevent jwt-auth to run on dashboard or prevent dokan run with requiring header? The whitelist is that. Can i make something to make it work? Thank you.

The error is that.

{
    "success": false,
    "statusCode": 403,
    "code": "jwt_auth_no_auth_header",
    "message": "Authorization header not found.",
    "data": []
}

and the whitelist filter is that.

add_filter('jwt_auth_whitelist', function ($endpoints) {
    $whitelistedEndpoints = array(
        '/wp-json/api/v1/register-user/',
        '/wp-json/api/v1/send-otp/',
        '/wp-json/api/v1/validate-otp/',
        '/wp-json/dokan/v1/*',
        '/wp-json/api/v1/reset-user-password/',
    );

    return array_unique(array_merge($endpoints, $whitelistedEndpoints));
}, 10, 1);
gioiliop7 commented 1 year ago

I made a plugin with the filter i send before and it works now. It might be priorities. Thank you.