Use obscure
as the field type
and Magento\Config\Model\Config\Backend\Encrypted
as the backend_model
:
<field
id='client_secret'
translate='label'
type='obscure'
sortOrder='3'
showInDefault='1'
showInWebsite='1'
showInStore='1'
>
<label>Client secret</label>
<comment><![CDATA[]]></comment>
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
<depends><field id='enable'>1</field></depends>
</field>