OAuth2 and API for WordPress

ajaxStardust

New member
Hi. I'm seeking guidance for learning how to create an OAuth2 secured API for WordPress.
One resource, among others I've referenced: https://developer.wordpress.com/docs/oauth2/

It's a test project to demonstrate coding skill. The project instructions start by creating two WP instances in Docker containers. I've done that with one on port :58485 and the other on :8080, using Docker / Docker Desktop for Win. db's are setup in the docker-compose.yml and the `docker-compose up -d` installs are functional, can change themes, plugins, etc.

Part 1:
"Create a plugin that exposes an API that is secured behind an OAuth2 layer. It should take a single parameter (let’s call it 'greeting') and store it in its database. The plugin should also display the greeting on the WordPress Admin screen. Install this on both WordPress environments."

Part 2:
"Create a Gutenberg block that, when install on one WordPress environment [in docker container], calls the API of the other WordPress [docker container] environment with a custom greeting."

I followed a tutorial, https://kinsta.com/blog/gutenberg-blocks/ and did successfully create the block as described. It's the OAuth and the API where I'm lacking the knowledge. I'm understanding everything, so I wouldn't say it's over my head, but it is challenging for my level of experience w/ WP.

I don't expect anyone to write the code for me, but if you have experience with this sort of project, I'd really appreciate any guidance you have. Maybe you have a recommended tutorial? I haven't checked YouTube yet as I prefer reading / text references.

Thank you for reading!
 
Did you check builtin wordpress rest api? https://developer.wordpress.org/rest-api/
If it not match properly then it should exists any plugin that allow you to log in with oauth2, so to write will be only building and sending requests with the api from one to the second wordpress instance
 
Back
Top