Custom OAuth for Thunderbird

Thunderbird Thunderbird Zuletzt aktualisiert: vor 1 Stunde

This article covers custom OAuth configuration for Thunderbird 155 and newer. See OAuth2 for Thunderbird for an overview.

NOTE: For most Thunderbird users, Thunderbird's built-in OAuth2 support for many common providers (like Google, Microsoft, Yahoo and AOL) is sufficient. If you don't need to customize your OAuth configuration, you can safely ignore this article.

Who is this for?

  • Organizations
  • Universities
  • IT administrators
  • Third-party provider developers

Thunderbird provides a WebExtension API that allows add-ons to register OAuth2 providers. Please see: oauthProvider API.

An add-on can provide OAuth2 configuration including:

  • Client ID
  • Authorization endpoint
  • Token endpoint
  • Scopes
  • PKCE settings
  • Browser flow settings

This allows organizations to package their OAuth2 configuration once and deploy it to many users. The API now supports two deployment models:

  1. Registering OAuth2 providers for new mail services that Thunderbird doesn't already know about.
  2. Overriding Thunderbird's built-in OAuth2 configuration for selected email domains or entire hostnames. This allows an organization to replace Thunderbird's built-in configuration only where required, while continuing to use the built-in provider for everyone else.

For example, an organization using Microsoft 365 with its own Azure application registration can transparently replace Thunderbird's built-in Microsoft OAuth2 configuration for users in its own email domain, while all other Microsoft 365 users continue using Thunderbird's built-in configuration.

Thunderbird also displays when OAuth2 settings are being provided by an extension, including the name of the extension, so users can easily identify where their configuration is coming from.

Administrator workflow

Organizations that wish to deploy a common OAuth2 configuration to many users can package it as a Thunderbird WebExtension.

1. Create the extension manifest

Create a manifest.json containing the OAuth provider registration and any required OAuth2 settings (client ID, authorization endpoint, token endpoint, scopes, PKCE settings, browser flow settings, hostname registrations, email domain overrides, etc.).

Example manifest.json

{

 "manifest_version": 2,
 "name": "Example Microsoft 365 OAuth Provider",
 "version": "1.0",
 "applications": {
   "gecko": {
     "id": "oauth-provider@example.org",
     "strict_min_version": "155.0"
   }
 },
 "oauth_provider": {
   "issuer": "this.must.be.unique",
   "clientId": "your-client-id-here-0000-000000000000",
   "clientSecret": "",
   "issuerIdentifier": "https://login.microsoftonline.com/your-tenant-id-0000-0000-000000000000/v2.0",
   "authorizationEndpoint": "https://login.microsoftonline.com/your-tenant-id-0000-0000-000000000000/oauth2/v2.0/authorize",
   "tokenEndpoint": "https://login.microsoftonline.com/your-tenant-id-0000-0000-000000000000/oauth2/v2.0/token",
   "redirectionEndpoint": "https://localhost",
   "usePKCE": true,
   "useExternalBrowser": true,
   "hostnames": [
     "office365.com",
     "outlook.com"
   ],
   "emailDomains": [
     "example.com"
   ],
   "scopes": "https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/POP.AccessAsUser.All https://outlook.office.com/SMTP.Send https://outlook.office.com/EWS.AccessAsUser.All offline_access"
 }

}

2. Package the extension into a standard Thunderbird extension (.xpi) file.

  • Simply zip the manifest.json file.
  • Rename to change the file extension from ".zip" to ".xpi.

3. Deploy the extension

Deploy the extension to users using the organization's preferred software deployment mechanism. Possible deployment methods include:

  • Enterprise Policy (policies.json)
  • Windows Group Policy (ADMX templates)
  • Microsoft Intune
  • macOS Configuration Profiles
  • Linux enterprise package deployment
  • Manual installation, if appropriate

Thunderbird's Enterprise Policies already support automatically installing extensions from either local files or URLs, as well as force-installing extensions so users cannot remove them. The newer ExtensionSettings policy also allows administrators to automatically install or force-install a specific extension by ID using an install_url.

4. Install / enable the extension

Depending on the deployment method, the extension may:

  • be installed automatically when Thunderbird starts,
  • be force-installed by enterprise policy,
  • or be installed manually by the user via the Add-ons Manager.

Once installed, no additional account configuration is normally required.

User experience

Once the extension is installed, Thunderbird automatically uses the registered OAuth2 provider whenever an account matches the configured hostname or email-domain rules.

When an extension is supplying the OAuth2 configuration, Thunderbird indicates this in Thunderbird app menu > Account Settings, by displaying the name of the extension that is providing the OAuth2 settings. This allows users and administrators to see which extension is customizing their OAuth configuration.

Who is this for?

  • Advanced users
  • Testing
  • Individual account configuration

If only a single account needs custom OAuth2 settings, Thunderbird also supports configuring OAuth2 directly for an individual account.

Unlike the add-on approach, these settings affect only that account and are not intended for organization-wide deployment.

This is currently available for Microsoft Exchange accounts, with support for IMAP currently under development.

Per-account OAuth2 Microsoft Exchange customization

General Setup Instructions

  1. Add a new email account: Thunderbird app menu > Add Account > Email and enter a Microsoft 365 email address e.g. nemo@o365.thunderbird.net and then click MANUAL CONFIGURATION on the bottom left of the Account hub.
  2. Click Microsoft Exchange or Microsoft 365 and then click Set up account.
  3. In the Exchange settings dialog, type one of the following URLs into the Enter the service URL field:
  4. Click Find settings. For EWS, Exchange Web Services will automatically be selected. For Graph, Microsoft Graph will be selected.
  5. Your Microsoft 365 email address e.g. nemo@o365.thunderbird.net you used previously should be be automatically entered into the Username field (if not, then correct it).
  6. For Authentication Method, select OAuth2.
  7. Click Advanced Configuration above the Connect button.
  8. In Server settings, click the Advanced… button above and to the right of Message Storage.
  9. Check the Override Office365 Settings check box.
  10. Enter the application ID your organization has set up in the Application ID field. Sometimes, it will be called a Client ID.
  11. Enter your organization's Microsoft 365 Tenant ID in the Tenant ID field.
  12. Optionally enter the Redirect URI. Default value is: http://localhost.
  13. Optionally enter the Endpoint Host. Default value is: https://login.microsoftonline.com
  14. Optionally enter the OAuth scopes. Default values are:
  15. Click the OK button to close the Advanced Account Settings dialog.
  16. Accept the Reauthorize Access dialog and trigger an email update. Messages should download and the account should operate as normal.

US Government Compute Cloud (GCC)

GCC does not include the common Thunderbird application ID, so all GCC users must have an organization that registers a Thunderbird application ID for their tenant IDs. When following the instructions above, use the Application ID and Tenant ID provided to you by your administrator and the following values for the other fields:

Future standards, like PACC and DCR, will eliminate most OAuth custom configuration

Thunderbird is considering implementing emerging standards intended to reduce the amount of manual OAuth2 configuration required including:

Over time, these standards should allow Thunderbird to discover or negotiate OAuth2 configuration automatically with compatible servers, reducing (or potentially eliminating) the need to distribute client IDs or manually configure OAuth settings.

Diese netten Menschen haben geholfen, diesen Artikel zu schreiben:

Illustration of hands

Mitmachen

Vergrößern und teilen Sie Ihr Fachwissen mit anderen. Beantworten Sie Fragen und verbessern Sie unsere Wissensdatenbank.

Weitere Informationen