Hi @greg,
Currently there is no way to add an endpoint to WP OAuth Server that is below the “oauth” URI. This is something that you are going to have to do in either a custom plugin that hooks into WP OAuth Server it in your functions.php theme file.
You can refer to WP OAuth Server main file as to how you can create your own custom endpoints. You should have no issue tapping into WP OAuth Server after that.
Thread Starter
Greg
(@rebootnow)
Thanks Justin. Actually, I’m trying to add an endpoint that is NOT below the oath URI.
I was assuming a custom plugin of some sort, but I guess a more precise framing of my question would be whether it is possible to add a custom endpoint at /something/api/{method} …
1. with a filter, OR
2. will I have to extend the WO_Server class
I think you’re saying it is #2.
BTW, thanks for such a rapid response to my original question.
You can create your own plugin and make your own custom endpoint from there. Then you can hook into WP OAuth Server’s core to do what you need to do in regards to retrieving/validating tokens.
I do not advocate that you edit WP OAuth Server directly as that will result in your changes being wiped out on any update of the plugin.
Thread Starter
Greg
(@rebootnow)
By “extend” I meant derive a new class with WO_Server as the parent. I wouldn’t edit your plugin code directly.
> hook into WP OAuth Server’s core to do what you need to do in regards to
> retrieving/validating tokens
Yes, this is what I’m trying to figure out. 🙂
Extending WP OAuth Server is done by using WordPress actions and filters. You can find more about WordPress actions and filters at https://codex.wordpress.org/Plugin_API/Hooks.
You can also find some more information on specific actions by browsing the cope for WP OAuth Server. We are currently making documentation tailored to specific tasks such as extending the API.