Why does authorizing my SMTP OAuth2 connector return an immediate error?

This page outlines what to do if you set up SMTP with OAuth2 (Microsoft/Azure) and the Authorize button returns an immediate error rather than completing the authorization flow for an existing SMTP connector that was working previously.

Error cause

Azure client secrets have a default expiration of 6 months. Once expired, the OAuth authorization flow fails immediately. If your SMTP connector was working previously and stopped without any other changes, an expired secret is the most likely cause.

How to resolve the error

Since this is most likely caused by an expired Azure client secret, create a new one and update your KnowledgeOwl SMTP settings:

  1. In Azure, go to your App registration.
  2. Go to Certificates & secrets.
  3. Create a new client secret. Set the expiration to 1 year or longer (the default is 6 months).
  4. Copy the new Client secret value.
  5. In KnowledgeOwl, go to Account > SMTP.
  6. Open the details for the SMTP connector you've been getting errors with.
  7. Paste the new Client secret in.
  8. Select Authorize again. The error should be resolved.
  9. Send a test email to confirm everything is working.