apprise icon indicating copy to clipboard operation
apprise copied to clipboard

Outdated Office 365 support?

Open aDingil opened this issue 2 years ago • 0 comments

:mega: Notification Service(s) Impacted Office 365

:lady_beetle: Describe the bug First awesome project, but i guess i found a bug: I followed the wiki instructions

  1. The wiki isnt up to date?!
  2. Using a private ms account the tenant id should be set to customers?!
  3. Are business emails supported?
  4. The official ms docs are using an other endpoint
  5. (Un)Encoded client secret doesnt change the outcome
  6. Assuming our {client_secret} is rt/djd/jjd is this specific client secret format needed?

:bulb: Screenshots and Logs tenant = tenant_id

root@xxxx:# apprise -vvvv -t "Test Message Title" -b "Test Message Body" o365://**tenant_id**:**email**@hotmail.com/**client_id**/**client_secret**
2023-03-22 17:35:30,340 - TRACE - Office 365 URL o365://**tenant_id**:**email**@hotmail.com/**client_id**/**client_secret** unpacked as:
user="**tenant_id**"
password="**email**"
port="None"
host="hotmail.com"
fullpath="/**client_id**/**client_secret**"
path="/**client_id**/"
query="**client_secret**"
schema="o365"
url="o365://**tenant_id**:**email**@hotmail.com/**client_id**/**client_secret**"
qsd="{}"
qsd+="{}"
qsd-="{}"
qsd:="{}"
secure="False"
verify="True"
client_id="**client_id**"
targets="[]"
tenant="**tenant_id**"
secret="**client_secret**"
email="**email**@hotmail.com"
2023-03-22 17:35:30,340 - DEBUG - Loaded Office 365 URL: o365://f...a:**email**@hotmail.com/9...f/****/**email**%40hotmail.com/?format=html&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2023-03-22 17:35:30,341 - DEBUG - Using selector: EpollSelector
2023-03-22 17:35:30,341 - INFO - Notifying 1 service(s) asynchronously.
2023-03-22 17:35:30,342 - DEBUG - Office 365 POST URL: https://login.microsoftonline.com/**tenant_id**/oauth2/v2.0/token (cert_verify=True)
2023-03-22 17:35:30,342 - DEBUG - Office 365 Payload: {'client_id': '**client_id**', 'client_secret': '**client_secret**', 'scope': 'https://graph.microsoft.com/.default', 'grant_type': 'client_credentials'}
2023-03-22 17:35:30,518 - DEBUG - Email To: **email**@hotmail.com
2023-03-22 17:35:30,518 - DEBUG - Office 365 POST URL: https://graph.microsoft.com/v1.0/users/**email**@hotmail.com/sendmail (cert_verify=True)
2023-03-22 17:35:30,518 - DEBUG - Office 365 Payload: {"Message": {"Subject": "Test Message Title", "Body": {"ContentType": "HTML", "Content": "Test Message Body"}, "ToRecipients": [{"EmailAddress": {"Address": "**email**@hotmail.com"}}]}, "SaveToSentItems": "false"}
2023-03-22 17:35:30,518 - DEBUG - Throttling for 0.023922s...
2023-03-22 17:35:30,636 - WARNING - Failed to send Office 365 POST to https://graph.microsoft.com/v1.0/users/**email**@hotmail.com/sendmail: , error=401.
2023-03-22 17:35:30,637 - DEBUG - Response Details:
b'{"error":{"code":"OrganizationFromTenantGuidNotFound","message":"The tenant for tenant guid \'**tenant_id**\' does not exist.","innerError":{"oAuthEventOperationId":"835720e6-0715-4c61-a1bd-e5d2de772cc9","oAuthEventcV":"GDT0LXV34PZesxII6at4vQ.1.1","errorUrl":"https://aka.ms/autherrors#error-InvalidTenant","requestId":"48554b76-b92e-4d0b-8896-c636ae9631f4","date":"2023-03-22T17:35:30"}}}'

tenant == customers

root@xxxx:~/# apprise -vvvv -t "Test Message Title" -b "Test Message Body" o365://consumers:**email**@hotmail.com/**client_id**/**client_secret**
2023-03-22 17:26:39,756 - TRACE - Office 365 URL o365://consumers:**email**@hotmail.com/**client_id**/**client_secret** unpacked as:
user="consumers"
password="**email**"
port="None"
host="hotmail.com"
fullpath="/**client_id**/**client_secret**"
path="/**client_id**/"
query="**client_secret**"
schema="o365"
url="o365://consumers:**email**@hotmail.com/**client_id**/**client_secret**"
qsd="{}"
qsd+="{}"
qsd-="{}"
qsd:="{}"
secure="False"
verify="True"
client_id="**client_id**"
targets="[]"
tenant="consumers"
secret="**client_secret**"
email="**email**@hotmail.com"
2023-03-22 17:26:39,757 - DEBUG - Loaded Office 365 URL: o365://c...s:**email**@hotmail.com/9...f/****/**email**%40hotmail.com/?format=html&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2023-03-22 17:26:39,757 - DEBUG - Using selector: EpollSelector
2023-03-22 17:26:39,757 - INFO - Notifying 1 service(s) asynchronously.
2023-03-22 17:26:39,758 - DEBUG - Office 365 POST URL: https://login.microsoftonline.com/consumers/oauth2/v2.0/token (cert_verify=True)
2023-03-22 17:26:39,758 - DEBUG - Office 365 Payload: {'client_id': '**client_id**', 'client_secret': '**client_secret**', 'scope': 'https://graph.microsoft.com/.default', 'grant_type': 'client_credentials'}
2023-03-22 17:26:39,887 - DEBUG - Email To: **email**@hotmail.com
2023-03-22 17:26:39,887 - DEBUG - Office 365 POST URL: https://graph.microsoft.com/v1.0/users/**email**@hotmail.com/sendmail (cert_verify=True)
2023-03-22 17:26:39,887 - DEBUG - Office 365 Payload: {"Message": {"Subject": "Test Message Title", "Body": {"ContentType": "HTML", "Content": "Test Message Body"}, "ToRecipients": [{"EmailAddress": {"Address": "**email**@hotmail.com"}}]}, "SaveToSentItems": "false"}
2023-03-22 17:26:39,888 - DEBUG - Throttling for 0.071054s...
2023-03-22 17:26:40,039 - WARNING - Failed to send Office 365 POST to https://graph.microsoft.com/v1.0/users/**email**@hotmail.com/sendmail: error=403.
2023-03-22 17:26:40,039 - DEBUG - Response Details:
b'{"error":{"code":"ErrorAccessDenied","message":"Access is denied. Check credentials and try again."}}'

:computer: Your System Details:

  • OS: Debian 11
  • Python Version: Python v3.9

:crystal_ball: Additional context I also upgraded to a azure subscription

aDingil avatar Mar 22 '23 17:03 aDingil