Email
Research
Email engineering guide

Microsoft OAuth for a user-owned mailbox

A safe Microsoft connection starts by choosing delegated or app-only access, registering the correct tenant audience, and keeping tokens out of browsers and business records.

Research surface only. This guide documents architecture and evaluation criteria; it does not describe a released DewEngine connector.
01
Access scenario

Choose delegated access unless the product truly acts alone

Delegated permissions let the app act within both the signed-in user's rights and the granted scopes. Application permissions let a service act without that user and generally require administrator consent, so they are not a shortcut for normal account connection.

02
Registration

Match the tenant and redirect model to the product

Decide whether the application supports one organization, many organizations, or personal Microsoft accounts. Register exact redirect URIs, use the authorization-code flow with PKCE where appropriate, and validate state and nonce values.

  • Tenant audience
  • Exact callback URLs
  • Server-side code exchange
  • Offline access only when background sync is required
03
Permissions

Request mail capabilities independently

Reading mail, modifying mail, and sending mail use distinct Microsoft Graph permissions. Ask for the least privileged set the product needs and show customers why each permission is required before redirecting to consent.

04
Token lifecycle

Treat revocation and tenant policy as expected states

Encrypt refresh material, rotate it according to Microsoft identity responses, and never log tokens. Conditional Access, administrator policy, password changes, and revoked consent can all force a fresh user or administrator decision.

  • Encrypted token vault
  • Single-flight refresh
  • Reconnect reason visible to the user
Questions

Before you build.

What is the difference between delegated and application permissions?+

Delegated access acts for a signed-in user and is limited by both the app's scopes and that user's rights. Application access uses the app's identity without a signed-in user and normally carries broader administrative consequences.

Does every Microsoft permission require administrator consent?+

No. Consent requirements vary by permission and tenant policy. The integration must handle user consent, administrator consent, and refusal without assuming one universal flow.

Can I use DewEngine's email connectors today?+

Not yet. Gmail, Microsoft Graph, and IMAP/SMTP connectors are planned. This guide documents the intended architecture and the provider requirements a production release must satisfy.

Build with us

Does this match the workflow your users need?

DewEngine is in development. Real use cases decide what ships first.

Share your use case