node.jsoauth-2.0backendnodemailervlan

authenticating a backend server with oauth but the server is on a private VLAN


I am trying to authenticate a backend server with OAUTH in order to send emails from that backend server. The thing I don't understand is how can I do this if the server will only ever be run locally on a VLAN.

Is this even possible?

What I am currently doing:

Backend server (Running Node) uses Basic Authentication credentials (username & password) to authenticate then send an email through Office 365 account to a user using SMTP. Basic auth is being deprecated though and is being replaced by OAUTH.

What I want to do:

Replace basic authentication with OAUTH to authenticate and send emails from backend server through office 365 account.

Any help would be greatly appreciated.


Solution

  • The usual migration path here is Client Credentials Flow which should work like this:

    This should work in locked down environments where outbound calls are restricted. Usually a whitelist is configured in the firewall - eg all URLs other than Azure AD are blocked.