Integration with Azure AD B2C


I am trying to setup a Custom Social Login Key for our Azure AD B2C instance.

So far I am having no luck. I’ve been recieving this error from the system after I click on Social Login button:
TypeError: login_via_office365() missing 2 required positional arguments: ‘code’ and ‘state’

Did anyone try to setup Azure AD login?

Any help appreciated.


I was able to get through this step - event though the error is strange, I iinvestigated Azure’s response and found out the redirect URI was mismatched I fixed it and now I am receiving following error after I login through azure:

File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/”, line 49, in get_oauth_keys
client_id, client_secret = frappe.get_value(“Social Login Key”, provider, [“client_id”, “client_secret”])
TypeError: cannot unpack non-iterable NoneType object

So in the end I was able to get through this error as well, the issue was the actual redirect uri (I incorrectly entered Office 365 endpoint, I had to investigate the code to discover the endpoint should be different).

Right now I am facing another error, this time on Azure AD B2C side - KeyError: 'Decoder failed to handle access_token with data as returned by provider. A different decoder may be needed. Provider returned: b'{“error”:“invalid_request”,“error_description”:"AADB2C90084: Public clients should not send a client_secret when redeeming a publicly acquired grant.\\r\\nCorrelation ID:

In the end, after long investigations, I found out it is not possible to integrate ERP Next with Azure AD B2C, because B2C does not support such user flow.

:wave: Appreciating your efforts! :clap:

Your research through this thread will surely gonna help others who are playing with Azure Active Directory B2C.

Was anyone able to use MS Entra ID formerly Azure Active Directory SSO with ERPNext?

Actually i was wondering the same
Use with Frappe SSO

I am trying but unable to do so yet