Search code examples
azureasp.net-coreemailoauth-2.0microsoft-exchange

Which O-Auth Flow to choose with .Net Core Server which will send (MS Exchange) mails even when no user is logged in


Hey I am overwhelmed with the different oauth flow types. I want to create an Webserver which can send mails even when no user is logged in. There will be an public available Website on which some actions might lead to an request to the server to send an mail. What would be the best OAuth flow to use here. Would it be best to use an client-credential one (if applicable to use for sending mails) where you have to create client credentials on the azure portal and than put them manually on the server. Or would it be better to have a configuration page where an admin could start an authorization code flow.

regards


Solution

  • Since your use case sounds like a daemon service, the Client Credentials flow would be best as you have already considered.

    Note that this requires the application registration to have the Mail.Send permission.