OAuth2.0 Invalid State Error

Hi GUys,
Can someone please assist us. We have update our ERPNext to Version 14.26 in order to get the OAUTH authentication method for our domain.
We have set up the App registration on the Azure side and set up the Connected APP on the ERPNext side. However we are now getting the following when trying to Authorize API Access on the email accounts:

Server Error
Traceback (most recent call last):
** File “apps/frappe/frappe/app.py”, line 66, in application**
** response = frappe.api.handle()**
** File “apps/frappe/frappe/api.py”, line 54, in handle**
** return frappe.handler.handle()**
** File “apps/frappe/frappe/handler.py”, line 45, in handle**
** data = execute_cmd(cmd)**
** File “apps/frappe/frappe/handler.py”, line 83, in execute_cmd**
** return frappe.call(method, frappe.form_dict)
** File “apps/frappe/frappe/init.py”, line 1608, in call**
** return fn(args, newargs)
** File “apps/frappe/frappe/integrations/doctype/connected_app/connected_app.py”, line 149, in callback
** frappe.throw(_(“Invalid state.”))**
** File “apps/frappe/frappe/init.py”, line 526, in throw**
** msgprint(**
** File “apps/frappe/frappe/init.py”, line 494, in msgprint**
** _raise_exception()**
** File “apps/frappe/frappe/init.py”, line 443, in _raise_exception**
** raise raise_exception(msg)**
frappe.exceptions.ValidationError: Invalid state.

Thank you in advance

I’m getting the same error in last versions … i will try to create app registration in azure side from scratch …

Hi, We found that the mistakes was due to trying to Authorize the email account while signed in as administrator and not as the user.
Once we signed in as the user we were able to Authorize the API from the email account