Microsoft Email Authentication Failed while setting up for User

Please refer Connecting Frappe/ERPNext to Microsoft 365 mail services OAuth