DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Cannot use Office 365 OAUTH2

 6 Replies
 1 Subscribed to this topic
 34 Subscribed to this forum
Sort:
Author
Messages
New Around Here Send Private Message
Posts: 1
New Around Here

Hello,

I have some throubles configuring Office 365 oauth2. I created the application in Office365 and configured it in my DNN test installation. The configuration in DNN seems to be correct (Microsoft authentication is completed, I see the informational message "Your OAuth provider's configuration has been completed.").

Anyway, clicking on Test connection button, I got an authentication error. After some tests, I discovered that this message changes if I change SMTP address (DNN should not use smtp settings if oauth has been configured). So, it seems that even if exchange connection has been configured, DNN tries to use SMTP settings.

Does anyone has a working OAUTH connection in DNN?

Senior Member Send Private Message
Posts: 1542
Senior Member

Hello:  

I don't know the answer to your question, because I don't use this feature and usually integrate SendGrid (or something similar, like Mailgun), instead of Office 365.  The troubleshooting and security tools are just good to pass up.  

So, I've put a link to your question into the community Slack channel to see if we can get someone else to respond that has used and/or tested this feature before.  Mostly likely, it's something easy to do. 

Growing Member Send Private Message
Posts: 82
Growing Member
What error code do you see?
In case it helps, for some situations I have set an Exchange Online connector to allow relaying from the web servers ip addresses... see Option 3 at this link...
https://learn.microsoft.c...ft-365-or-office-365
Advanced Member Send Private Message
Posts: 250
Advanced Member
I never got to make O365/Exchange OAuth2 work myself either. Not sure if something is broke but at the bare minimum it is lacking documentation on how to make it work. On top of that I have a lot of issues with my microsoft logins (multiple accounts with same email).

That being said, to use OAuth2 for email in DNN, you have to use the Mailkit provider and not the legacy one. And then in the Mailkit repository, there is some documentation on how to setup (although not DNN specific) but it may help if anyone wants to give it a try and document a success case... https://github.com/jstedf...er/ExchangeOAuth2.md
Growing Member Send Private Message
Posts: 82
Growing Member
My understanding of OAUTH2 is that it just authenticates user identity. You possibly have that part correct.
However, it does not imply "it must then be ok to send an email from this endpoint".
You still need to configure Exchange Online to allow the DNN server (endpoint) to send the email, hence creating a connector using Option 3 at https://learn.microsoft.c...ft-365-or-office-365
Check admin and error logs for SMTP code 5.7.1 "unable to relay" or similar.
Advanced Member Send Private Message
Posts: 250
Advanced Member
Makes sense, if anyone goes through the entire process and gets it to work, please, please, please, take notes along the way, documenting this would be awesome at https://docs.dnncommunity.org/
Growing Member Send Private Message
Posts: 72
Growing Member

Thank you Mr Needle for adding the procedure to the DNN Documentation :-)
https://docs.dnncommunity.org/content/tutorials/server/smtp-servers/set-up-oauth-microsoft-365/index.html

These Forums are dedicated to the discussion of DNN Platform.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved