Frappe OAuth - How to disable native login form

Workaround (no custom app)

Add following script to Website Script or custom Website Theme:

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

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

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.
2 Likes