Hot answers tagged

3

This is how I did it, but I feel it could be better. For one thing, this results in HTTP 500... 403 would be preferable add_filter( 'json_authentication_errors', function( $authenticated ) { if( !$authenticated ) { return new WP_Error('Access Denied'); } }, 99 ); (I understand this'll work for Basic Auth too)


2

I know it's a bit far fetched, but might help. For anyone looking for WP REST API implementation with JWT, here's our solution. Add it to your function.php add_action('rest_api_init', 'wp_rest_user_endpoints'); /** * Register a new user * * @param WP_REST_Request $request Full details about the request. * @return array $args. **/ function ...


1

I have seen many plugins do it this way. But it definitely seems like a very tedious step to follow for the user in order to use the plugin... Is it the right method? Yes. Should I somehow, store my Consumer API key & secret details on my server? And any of my distributed plugins should automatically fetch it from my server? Further, are the ...


1

I approached this slightly different for those interested. I wanted to keep my API as light as possible, and not bloat it with versions/revisions and users, so ended up creating a 2nd Laravel instance. On this 2nd Laravel instance (consumer) we used Laravel Socialite as we already use Google as SSO provider. The user logs in, this is where the user ...


1

This depends on what is it that you are developing. If it is a plugin, you have to store such settings in options as the last thing site owner should be asked to do is to modify their config file. If it is your own site, just make it a constant that is declared in your code if you do not want it to be configurable by the admin. There is no advantage in ...


1

Using JWT you can extends the WP REST API using JSON Web Tokens Authentication as an authentication method. WordPress REST API Authentication: Default cookie authentication : cookie authentication is the only authentication mechanism available natively within WordPress. Remote applications : To support remote applications, we need to add a new REST API ...


1

There are a lot of examples of user registration using the WP REST API and the OAuth server implementation for WP API http://oauth1.wp-api.org/. I'm sure there were less 6 months ago when you originally posted but here are a couple of great examples that will get you going. Example OAuth Client WP REST API: Setting Up and Using OAuth 1.0a Authentication ...


1

You will have to follow the details from the developers website located here. (FYI, I am one lead on the project). Basically, what is boils down to, is that you are going to create a client in WP OAuth Server and give the details to your authenticated users. Your users would then setup using the grant type of "password" (user credentials). This is not ideal ...


1

If you can stick to overriding just functions that are located in wp-includes/pluggable.php then you should be able to avoid any kind of plugin conflicts ... unless you are using plugins that are overriding the same pluggable functions. Just make sure that your functions are declared before pluggables is loaded. Plugins are loaded before the pluggables file ...


Only top voted, non community-wiki answers of a minimum length are eligible