Open rexwreyes opened 1 year ago
Hello @rexwreyes, I assume you've read the "Whitelisting Endpoints" section here? If it's not working for you, please do paste some code that you're using, and I'll be happy to check it over.
I have this in my functions.php
add_filter( 'jwt_auth_whitelist', function ( $endpoints ) { $your_endpoints = array( '/wp-json/mesilinka/v1/upload', ); return array_unique( array_merge( $endpoints, $your_endpoints ) ); } );
Is this right? Should it be somewhere else?
oh here is the rest init
add_action('rest_api_init', function () { register_rest_route('mesilinka/v1', '/upload', array( 'methods' => 'POST', 'callback' => 's3toPost', 'permission_callback' => function () { return true; }, 'args' => array( 'id' => array( 'validate_callback' => function ($param, $request, $key) { return is_numeric($param); } ), ), )); });
OK, that looks like it should work, though I haven't tested it. To ask an obvious question, I assume you are sending the JWT with your requests once you've got one...? What error are you getting exactly?
I can get the token and validate it with no issues. Trying to hit any other endpoint however I get Access Denied. I thought i saw some method of whitelisting the routes you want to use but can't seem to figure out how to do this.