Microsoft 365 oauth2 for Nextcloud Mail

Good morning - new user here.

I have been setting up and tinkering with nextcloud over the last couple of days.

I am struggling with setting up Mail to use my microsoft 365 mail account.

As it is well documented - Microsoft no longer allows simple auth.

I have setup everything required to get oauth to work with the exception of the reply address or redirect url in Azure.

Where should I be pointing this to on my server? I haven’t been able to find any documentation on this.

When I sign into my microsoft account via the popup, it goes through the authentication fine, but it fails as azure doesnt know where to send the authentication back to.

Any ideas on how to compile the correct URL?

Thank you all

here