I'm using WordPress REST API (Version 2), and I want to authenticate Android native app with my self-hosted WordPress site. How can I perform that using username and password ?


The best way to authenticate an app with the REST API would be to use OAuth. There's a good section on OAuth Authentication the REST API documentation site. You will need to install the OAuth1 plugin on your site as well.

There are some gotchas with implementing the OAuth plugin on WordPress. I found this article on CSS Tricks captured some of the complexity of setting it up.

You'll need an OAuth library in your Android application as well, I've seen ScribeJava recommended more than once. In fact, here's a StackOverflow answer with a good implementation example.

If your app is just in testing mode, you could use Basic Authentication instead of OAuth, because it's easier to implement, but it's not recommended for production use because it's less secure.

| improve this answer | |
  • Can we authenticate directly with username & password from our app or we have to redirect users to site for authentification and then redirect them to the app. – WaWa Aug 5 '16 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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