When you want to create a new field for input any password in system configuration Magento 2 but you don't want it to show the password as a text.
Here we will guide you on how to create a password type field in the admin configuration in Magento 2.
We use the “obscure” field type and
Magento\Config\Model\Config\Backend\Encrypted as the backend_model
In the file <Module_Name>/etc/system.xml add a new field as below:
<field id='magenest_password' translate='label' type='obscure' sortOrder='3' showInDefault='1' showInWebsite='1' showInStore='1'> <label>Password</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field>
After create in System configuration will show this field for input password as image:
You can see that in configuration at the admin panel with the name Password. When you put or type some value then it will convert the value into a password with dot sign.
In short, when creating a field in the back-end, developers need to create an encrypted field for it for security purpose.
READ MORE. How to encrypt and decrypt data in Magento 2 - Magenest Blog