Best answer

Using Application Passwords for Authentication to WordPress REST API

  • 7 January 2021
  • 2 replies
  • 587 views

Userlevel 1

I have created a new app on Zapier and need to set authentication. Authentication will be to a users own WordPress website, using a username and application password combo. I therefore need to capture the users own WordPress URL via an input field, as well as their username and application password.

Basic Auth works when I test but as I cannot define custom input fields, I can only authenticate against a pre-defined WordPress site - no good to me as users will have their own URL and website which they need to authenticate against.

Which authentication method is best for me to use and display the required input fields (URL, Username, Password)? And then how do I put the username and password entries into the header so that WordPress recognises them and authenticates?

icon

Best answer by ikbelkirasan 7 January 2021, 12:35

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +12

@mikehoward1977 - Try using API key authentication instead. You’ll then be able to add your custom fields. However, you’ll have to set the Authorization header by yourself.

Here’s a code snippet showing how to do so:

Authorization: `Basic ${Buffer.from(
`${bundle.authData.username}:${bundle.authData.password}`
).toString("base64")}`;

 

Userlevel 1

Works perfectly, thank you!