Solution:
What you could do, the simpler way:
- create an Ajax action or a REST API route
- as you can read in the documentation, the authentication is cookie-based. So once the user is logged in from the WordPress login form, the authentication cookie is added to your browsing session
- without overrides, the cookie will also be forwarded when using JS HTTP queries (eg ajax)
- your route could check something like
is_user_logged_in()
orwp_get_current_user()
like available methods. And return the result (among other things if needed) to your plugin JS - you may need to change the WordPress cookie configuration, so they can be accessed from anywhere (any domain), check this.
Better way:
- would be to use a plugin like this to implement REST API Oauth2 authentication
- user should be able to login directly from the extension window (need development), and then use a refresh token feature to keep the user logged in.
- I believe you may also need to update your actual login form, if its classic or OAuth rest API login, should be able to send back the required OAuth token (access and refresh tokens), to the frontend (then stored in local storage or else) to be used by the extension. To prevent having to log in twice.