How to store API authentication password?

I am connecting a WP site to a service through the service API.

The API authentication of this service is done using the service account username and password, not API keys:

  • You send a request to the service API and give the account username and password.
  • You receive a token, valid for a number of hours, that allows you to make API requests.

The problem that I see is that the service account password will have to be stored in the WP database, to be used in the API authentication.

I can encrypt the password in the database, but in a way that allows it to be decrypted back to a simple text form, which is not secure.

I cannot encrypt it into a hash, store the hash and use that for the authentication.

What is the best practice for storing the password in this situation?

Topic encryption password api Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.