Frappe OAuth - How to disable native login form

Looking to disable frappe native login when OAuth Provider is configured in a frappe instance. Is there is a simple way to configure this and force the login page automatically to the OAuth login URL itself?

If not, any guidance on how to go about tapping login event and customizing it to auto-redirect to configured OAuth login URL (typically the OAuth provider button below the login form) would be a great help.

2+ years later, did you get anywhere with this @nikhildx? I’m faced with either using ERPNext as a provider, or what may be better now that I understand more, using another IdP [Say IdentityServer] and make ERPNext a “client” of IdentitiyServer.

You should create a new app, include the login.html and edit it to your needs :slight_smile:

1 Like

Workaround (no custom app)

Add following script to Website Script or custom Website Theme:

// Detect login page
if ($('#page-login').length) {
    // Hide page

    // Login using custom social login button
    const loginBtn = $('.btn-castlecraft').length
        ? $('.btn-castlecraft')[0]
        : undefined;
    loginBtn &&;

Note : replace .btn-castlecraft with your button’s class name in above code.

Additionally, do the following if required:

  • disable login button from Website Settings
  • add a home page that redirects to desired location.

Sorry for the delay. I’ll take a look at this once my IdP is online.

if you are looking forward to use frappe app as resource server then no need to even login into frappe.

refer this GitHub - castlecraft/cfe: Castlecraft Extensions for Frappe Framework based Resource Servers