Skip to content

auth success but get_messages Resource not found #1171

@0x00kh

Description

@0x00kh
account = Account(credentials, auth_flow_type="credentials", tenant_id=tenant_id)

if not account.is_authenticated:  # will check if there is a token and has not expired
    # ask for a login using console based authentication. See Authentication for other flows
    if account.authenticate() is False:
        raise RuntimeError("Authentication Failed")
    print("Authentication Success")

messages = account.mailbox().get_messages()

RETURN ERROR

Authentication Success
Client Error: 400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/messages?%24top=25 | Error Message: Resource not found for the segment 'messages'. | Error Code: 
Traceback (most recent call last):
  File "/Users/test/test2.py", line 24, in <module>
    messages = account.mailbox().get_messages()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/test/miniforge3/envs/email/lib/python3.12/site-packages/O365/mailbox.py", line 486, in get_messages
    response = self.con.get(url, params=params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/test/miniforge3/envs/email/lib/python3.12/site-packages/O365/connection.py", line 1092, in get
    return self.oauth_request(url, "get", params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/test/miniforge3/envs/email/lib/python3.12/site-packages/O365/connection.py", line 1073, in oauth_request
    return self._internal_request(self.session, url, method, ignore401=True, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/test/miniforge3/envs/email/lib/python3.12/site-packages/O365/connection.py", line 1018, in _internal_request
    raise HTTPError(
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/messages?%24top=25 | Error Message: Resource not found for the segment 'messages'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions