User Management and Automatic Login from External System

Hi everyone,

I am currently building an SaaS for our customers. However due to increasingly requests for ERP functionalities from my customers, I am evaluating ERPNext to power the ERP part of our SaaS.

In the Saas I built, we already have a login and user & access role management system. I plan to make a seamless login from our system to ERPNext.

The flow will be like below:

  1. User login into our Saas, company1.app.example.com.
  2. We already created a ERPNext instance for them company1.erp.example.com.
  3. When user want to go to the, we provide a URL company1.app.example.com/erp
  4. Our system then do automatic session creation in ERPNext, and will redirect to company1.erp.example.com
  5. User will see they are already login in their ERPNext system.

In addition to that, I want to be able to do user management in our SaaS, rather than in ERPNext. e.g. when user in the customer company want to add their employee it reflected automatically in their ERPNext system.

I also want to disable the login and user management in ERPNext, so any login & user management has to be done in my SaaS system.

How would I achieve this using ERPNext. Really appreciate for the answers and pointers to the relevant documentations.

Cheers!

Hi @van_odin:

Frappe Framework, that’s actually besides under ERPNext, provides different login strategies. You could use ERPNext for login, and use OAuth from your SaaS, or the reverse way.

Check this:
https://docs.frappe.io/framework/user/en/guides/integration/openid_connect_and_frappe_social_login
https://docs.frappe.io/framework/user/en/guides/integration/social_login_key

You can also manage users on ERPNext side using REST Api from any external app.
Hope this helps.

Implementing OAuth both from my SaaS or ERPNext seems like a bit overkill.

I am looking for something like wp_set_auth_cookie in WordPress (wp_set_auth_cookie() – Function | Developer.WordPress.org).

From your link I found Token based auth. Is this a similar thing?

https://docs.frappe.io/framework/user/en/guides/integration/how_to_setup_token_based_auth