See the Paperless-ngx documentation about setting up OAuth. In both cases you will need to specify your Paperless-ngx installation's Redirect URI as e.g. https://paperless.example.com/api/oauth/callback/.
Login to the Azure portal, open the App registrations page, and click New registration.
Choose the account type (single tenant vs multi-tenant).
For personal M365 accounts use the option Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox).
Set redirect URI.
Navigate to the Authentication tab. Set "Implicit grant and hybrid flows" to allow both access and id tokens,
Navigate to the Certificates & Secrets tab and add a new secret and note this value (not ID).
Finally, on the "Overview" tab obtain the "Application (client) ID"
When using Outlook, you may need to change the character set in Paperless-ngx to US-ASCII in order to process emails.