Hide admin login in Magento 2

If you are using a SSO to login into Magento admin, you may need to hide the default Admin login functionality.

I am mentioning here an important code snippet to hide the admin login form.

1) Create an admin layout
For example, I have a module DecryptWeb_Admin, I am going to create a layout file at

app/code/DecryptWeb/Admin/view/adminhtml/layout/adminhtml_auth_login.xml

2) Reference the existing admin block

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
    <referenceBlock name="admin.login">
        <action method="setTemplate"><!-- you can also use ifconfig here to set the flag from configuration-->
            <argument name="setDisplay"  xsi:type="boolean">false</argument>
        </action>   
    </referenceBlock>      
    </body>
</page>

Hope this is helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top