A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
There are several things to configure here. First, SMTP Auth must be enabled, and if you are going to use the app-only scenario, it needs to be enabled tenant-wide. This can be done either in the UI or via PowerShell, instructions are here: https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/authenticated-client-smtp-submission
Next are the authentication bits, which you seem to have configured correctly. Just in case, you can share the sanitized token with us to verify.
On the authorization layer, there are few ways to control access on Exchange side of things. Application access policies are the "old" way, but can still be used, so you need to check for those. This is only possible via PowerShell currently: https://practical365.com/application-access-policies-in-exchange-online/
The "new" way is via the so-called RBAC for applications. Part of the setup process for it requires that a matching service principal for your app is provisioned in Exchange Online. Unfortunately, this step is also possible only via PowerShell, no other way around it.
Once a service principal is provisioned, you can either assign mailbox-level permissions (https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/smtp-app-rbac-onboarding) or grant access via management scopes... again via PowerShell: https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth#use-client-credentials-grant-flow-to-authenticate-smtp-imap-and-pop-connections