Syncing Nextcloud with Thunderbird and Lightning

There are some tricks to getting this working: using the wrong CalDAV URL, username, password, sync tool, or version can cause a lot of frustration. Here’s what worked for me here in 2021.

Email

Just use the default Thunderbird wizard to add a new email account. Use your normal login password, even if you’ve got 2FA set up. (Apparently app passwords don’t work for IMAP/SMTP.)

Calendar and Contacts

First, if you have 2FA set up for Nextcloud, create an App Password for Thunderbird at: /settings/user/security under Devices & Session. Normal passwords will fail with an error like this if you try to use your regular password on an account with two factor authentication enabled.

  <s:exception>OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden</s:exception>
  <s:message/>
  <o:hint xmlns:o="o:">password login forbidden</o:hint>

Second, the default CalDAV support in Thunderbird and Lightning is crappy. Ensure you have the latest version of Thunderbird installed (I removed the default Ubuntu version 68 and installed version 78 straight from a ZIP file from the Thunderbird website) and then install the TbSync and CalDAV Provider add-ons.

To install add-ons in Thunderbird, click the Hamburger (three lines) menu near the top-right corner of the main pane and choose Add-Ons.

Once both plugins are installed, open TbSync by clicking “TbSync: Idle” in the bottom-right corner of the main Thunderbird or Lightning window (the Home or Calendar tabs). There you can click Account Actions and add an account.

To successfully add a NextCloud CalDAV or CardDAV account, you’ll probably need to do it manually. Choose Manual Configuration instead of Automatic. Supply the username (usually the part before @ in your email address) and password (either your login password or the app password you created for 2FA). The server addresses can be found on the Calendar and Contact pages, and should be the primary addresses (not the per-calendar address.) For example go to /apps/calendar and click Settings & Import at the bottom left. Then click Copy Primary CalDAV Address and paste that into the appropriate TbSync field. Finally, go to /apps/contacts and click Settings, click the three dot menu next to your Contacts folder, click Copy Link, and paste into the appropriate TbSync field.

Your TbSync configuration should now look something like this:

Account name: Your Nextcloud
User name: you
Password: your-password-here
CalDAV server address: https://nextcloud.example.com/cloud/remote.php/dav
CardDAV server address: https://nextcloud.example.com/remote.php/dav/addressbooks/users/your_name/contacts/

If all goes well, the main TbSync window will accept the settings and you can check [x] Enable and synchronize this account. Then you can configure each contacts folder or calendar you’ve selected.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s