0

I have been looking all over google and all I can find is fairly old plugins that appear outdated in assisting with an API registration/login.

Basically, I have a mobile app that needs to get data from the WordPress backend via the API. I want users to be able to register on the app and to obviously log in.

Is there support out of the box for this in WordPress or do you need to create a custom route etc?

I looked here:

https://developer.wordpress.org/rest-api/reference/users/#create-a-user

and I tried to use postman to post username, email and password to this endpoint

https://example.com/wp-json/wp/v2/users/

But it gives me an error. Any advice on how to do this would be greatly appreciated.

1
  • BTW, my answer covers WP core, and recommendations are off topic on this site as Q's/A's, but, you may find this plugin very interesting/useful github.com/humanmade/rest-sessions
    – Tom J Nowell
    Commented Nov 24, 2020 at 13:11

1 Answer 1

0

Is there support out of the box for this in WordPress or do you need to create a custom route etc?

No, there is no endpoint for user login and registration. You would need to install an authentication plugin designed for remote auth such as the OAuth2 plugin, or wait until 5.6 adds application passwords. No endpoint exists for user registration.

and I tried to use postman to post username, email and password to this endpoint

That endpoint can be used to create new users but only if made as an authenticated request from a user that can do that, aka the add new user button in the backend. It can't be used for registration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.