Kentico 13 and Email OAuth Credentials for Microsoft Exchange Online

Jason Herz asked on May 19, 2026 20:13

I am trying to use OAuth 2.0 to connect to Office 365 Exchange for email sending. I have configured the site a shown in the documentation. I am using CMS.EmailEngine.MicrosoftExchangeOAuthProvider.

However, the Redirect URI in the documentation, https://< site domain >/CMSModules/EmailEngine/Pages/OAuth2AccessTokenDialog.aspx?redirected=1, is not allowed at Azure. Azure will not allow return URI's that have a query string.

When I request a token, the authentication popup has this in the URL https://login.microsoftonline.com/GUID/oauth2/v2.0/authorize?client_id=XXXXX&response_type=code&state=XXXXX&scope=offline_access+https%3a%2f%2foutlook.office.com%2fPOP.AccessAsUser.All+https%3a%2f%2foutlook.office.com%2fSMTP.Send&redirect_uri=https%3a%2f%2fwww.mydomain.com%2fAdmin%2fCMSModules%2fEmailEngine%2fPages%2fOAuth2AccessTokenDialog.aspx%3fredirected%3d1

and I get this error from Microsoft

AADSTS50011: The redirect URI 'https://www.msinteractive.com/Admin/CMSModules/EmailEngine/Pages/OAuth2AccessTokenDialog.aspx?redirected=1' specified in the request does not match the redirect URIs configured for the application '0d7237f2-1874-426d-a141-933151601e5a'. Make sure the redirect URI sent in the request matches one added to your application in the Azure portal.

I tried to remove this from the URL (%3fredirected%3d1) and post report it. Microsoft then accepts the authentication, but when I redirect back to Kentico I get the error "Credentials not found."

How can I use OAuth with Kentico 13?

----------Environment

Kentico Xperience version: [v13.0.165]

.NET version: [8]

Execution environment: [Private cloud (AWS)]

Link to relevant https://docs.kentico.com/13/configuring-xperience/configuring-smtp-servers/oauth-for-email-servers

Recent Answers


Faisal Ahmed Rony answered on May 20, 2026 05:48

Hi Jason! Azure is quite strict about query strings in Redirect URIs. Try registering the URI in Azure without the "?redirected=1" part. If Kentico still appends it, you might need a custom URL rewrite rule or a custom OAuth provider to strip the parameter before it hits Microsoft. Hope this helps!

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on May 20, 2026 08:13 (last edited on May 20, 2026 08:14)

Hi, where and how are you adding the Redirect URI? I just tested it and it works fine. I logged into the Azure portal using the user account I want to use for the authentication/email sending.
Then App registrations -> my app-> left menu "Manage" -> Authentication (Preview) and it is working fine. Link to Imgur screen shot

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.