Re-using WP login for external REST services
-
Hello.
I’d like integrating a set of external REST services with WordPress. The idea is build up a plugin that will actually add the content to WP post. That content will be a mix of HTML5, CSS and JS. JS will use AJAX requests targeted to mentioned REST services for displaying the content. The later has to be per-user specific. This means, REST services written with Lumen and using their own database, should be aware of WP users logged in the site.
I thought using JWT tokens for this. My idea is, when a user logs-in, a JWT token is added to session cookie. That same session cookie is consumed by REST services. As WP and the REST services server would share the same secret, WP could embed the username in the JWT. On the other hand, REST services server could check JWT validity and if valid, could extract the username from it and return the right content.
A few quesitons about this:
– is there an existing way to switch WP on using JWT which I could reuse?
– if not, is it possible and how is it possible to add JWT functionality needed?
– I would appreciate also any other thoughts and ideas on how to approach the mentioned problem?Thanks in advance for any hint and discussion 🙂
Sincerely,
Damir
The topic ‘Re-using WP login for external REST services’ is closed to new replies.