{"id":104120,"date":"2017-12-11T10:32:21","date_gmt":"2017-12-11T10:32:21","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=104120"},"modified":"2024-02-23T10:38:35","modified_gmt":"2024-02-23T10:38:35","slug":"how-to-create-an-obscure-field-in-admin-configuration-in-magento2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/","title":{"rendered":"How to create a password type field in admin configuration in magento2"},"content":{"rendered":"\n<p>To create a&nbsp;field &nbsp;as password type in which input text is abstruse at admin configuration<\/p>\n\n\n\n<p>Use <strong>obscure<\/strong> as the field type and<\/p>\n\n\n\n<p><strong>Magento\\Config\\Model\\Config\\Backend\\Encrypted <\/strong>as the backend_model<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;field id=&#039;api_secret&#039; translate=&#039;label&#039; type=&#039;obscure&#039; sortOrder=&#039;3&#039; showInDefault=&#039;1&#039; showInWebsite=&#039;1&#039; showInStore=&#039;1&#039;&gt;\n&lt;label&gt;Api key&lt;\/label&gt;\n&lt;backend_model&gt;Magento\\Config\\Model\\Config\\Backend\\Encrypted&lt;\/backend_model&gt;\n&lt;\/field&gt;<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1200\" height=\"519\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2-1200x519.png\" alt=\"\" class=\"wp-image-104136\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2-1200x519.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2-250x108.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2-300x130.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2-768x332.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2.png 1300w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>after that you see that in configuration at admin panel a text field is created under name <strong>&#8220;Api&nbsp;key&#8221;<\/strong> and when you put or type some value in it then it will show as a password with dot sign.<\/p>\n\n\n\n<p>Actually, obscure field type <strong>encrypts<\/strong> the value of fields.<\/p>\n\n\n\n<p>To get the decrypted value of &nbsp;configuration&#8217;s obscure type field we will have to use<\/p>\n\n\n\n<p><strong>\\Magento\\Framework\\Encryption\\EncryptorInterface <\/strong>interface<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nClass Encryptor\n\nprotected $_enc;\n\npublic function __construct(\n        \\Magento\\Framework\\Encryption\\EncryptorInterface $enc\n    )\n    {\n        $this-&gt;_enc = $enc;\n        parent::__construct($context);\n    }\n\/\/here $val contain the encrypted configuration value \n$val = &#039;asdfgh-erp45dfrtgbnhjlkouojutywer&#039;;\n$val = $this-&gt;_enc-&gt;decrypt($val);\n?&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>To create a&nbsp;field &nbsp;as password type in which input text is abstruse at admin configuration Use obscure as the field type and Magento\\Config\\Model\\Config\\Backend\\Encrypted as the backend_model after that you see that in configuration at admin panel a text field is created under name &#8220;Api&nbsp;key&#8221; and when you put or type some value in it then <a href=\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":169,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[302],"tags":[],"class_list":["post-104120","post","type-post","status-publish","format-standard","hentry","category-magento2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to create a password type field in admin configuration in magento2 - Webkul Blog<\/title>\n<meta name=\"description\" content=\"To create a\u00a0field \u00a0as password type in which input text is abstruse at admin configuration\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create a password type field in admin configuration in magento2 - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"To create a\u00a0field \u00a0as password type in which input text is abstruse at admin configuration\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-12-11T10:32:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-23T10:38:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2-1200x519.png\" \/>\n<meta name=\"author\" content=\"Ramakant Pandey\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ramakant Pandey\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/\"},\"author\":{\"name\":\"Ramakant Pandey\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/e900dd4548d308477830b501e60214fa\"},\"headline\":\"How to create a password type field in admin configuration in magento2\",\"datePublished\":\"2017-12-11T10:32:21+00:00\",\"dateModified\":\"2024-02-23T10:38:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/\"},\"wordCount\":117,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2-1200x519.png\",\"articleSection\":[\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/\",\"name\":\"How to create a password type field in admin configuration in magento2 - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2-1200x519.png\",\"datePublished\":\"2017-12-11T10:32:21+00:00\",\"dateModified\":\"2024-02-23T10:38:35+00:00\",\"description\":\"To create a\u00a0field \u00a0as password type in which input text is abstruse at admin configuration\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2.png\",\"width\":1300,\"height\":562},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to create a password type field in admin configuration in magento2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/e900dd4548d308477830b501e60214fa\",\"name\":\"Ramakant Pandey\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1ea0042b92622eca16d3d8512f51f69bb43d023e0a40fa07bfc6fc5ca068f56c?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1ea0042b92622eca16d3d8512f51f69bb43d023e0a40fa07bfc6fc5ca068f56c?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Ramakant Pandey\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/ramakant-pandey019\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to create a password type field in admin configuration in magento2 - Webkul Blog","description":"To create a\u00a0field \u00a0as password type in which input text is abstruse at admin configuration","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/","og_locale":"en_US","og_type":"article","og_title":"How to create a password type field in admin configuration in magento2 - Webkul Blog","og_description":"To create a\u00a0field \u00a0as password type in which input text is abstruse at admin configuration","og_url":"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2017-12-11T10:32:21+00:00","article_modified_time":"2024-02-23T10:38:35+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2-1200x519.png","type":"","width":"","height":""}],"author":"Ramakant Pandey","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Ramakant Pandey","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/"},"author":{"name":"Ramakant Pandey","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/e900dd4548d308477830b501e60214fa"},"headline":"How to create a password type field in admin configuration in magento2","datePublished":"2017-12-11T10:32:21+00:00","dateModified":"2024-02-23T10:38:35+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/"},"wordCount":117,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2-1200x519.png","articleSection":["Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/","url":"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/","name":"How to create a password type field in admin configuration in magento2 - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2-1200x519.png","datePublished":"2017-12-11T10:32:21+00:00","dateModified":"2024-02-23T10:38:35+00:00","description":"To create a\u00a0field \u00a0as password type in which input text is abstruse at admin configuration","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/blog_1-2.png","width":1300,"height":562},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-create-an-obscure-field-in-admin-configuration-in-magento2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to create a password type field in admin configuration in magento2"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/e900dd4548d308477830b501e60214fa","name":"Ramakant Pandey","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1ea0042b92622eca16d3d8512f51f69bb43d023e0a40fa07bfc6fc5ca068f56c?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ea0042b92622eca16d3d8512f51f69bb43d023e0a40fa07bfc6fc5ca068f56c?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Ramakant Pandey"},"url":"https:\/\/webkul.com\/blog\/author\/ramakant-pandey019\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/104120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/169"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=104120"}],"version-history":[{"count":7,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/104120\/revisions"}],"predecessor-version":[{"id":424088,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/104120\/revisions\/424088"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=104120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=104120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=104120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}