I check and the URI on azure was wrong. I fix and now I have thi error
Server Error
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 60, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 61, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1042, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/integrations/oauth2_logins.py”, line 28, in login_via_office365
login_via_oauth2_id_token(“office_365”, code, state, decoder=decoder_compat)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/oauth.py”, line 116, in login_via_oauth2_id_token
info = get_info_via_oauth(provider, code, decoder, id_token=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/oauth.py”, line 148, in get_info_via_oauth
frappe.throw(_(“Email not verified with {0}”).format(provider.title()))
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 364, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 350, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 316, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: E-mail não verificado com Office_365
We manage to fix it by going in Azure-> App Registration->Token Configuration and choose Add optional claim and select email for all 3 Access, Token, SAML might work with just one but have not tested
KeyError: ‘Decoder failed to handle access_token with data as returned by provider. A different decoder may be needed.’
This looks like an issue with python3? Similar issue happening here with Box’s API but I haven’t looked too much more into the issue on ERPNext side and how it handles this.
For Python 3, the bytes response has to be decoded first. You can do that by passing it a custom decoder: