linagora / tmail-flutter

A multi-platform (Flutter) application for reading your emails, with your favorite devices, using the JMAP protocol!
GNU Affero General Public License v3.0
327 stars 74 forks source link

"Unknown error occurred, please try again" with username@example.org login; works with username #2984

Open amessina opened 4 months ago

amessina commented 4 months ago

Description

When I attempt to login to my Cyrus-IMAPd 3.8.3 server with my full username@example.org, the login on the server succeeds, but Twake mail reports "Unknown error occurred, please try again". When just using my username the app works properly.

Expected result

It should correctly process login using full email address username@example.org.

Current behavior

It fails with the full email address login and succeeds with only a username.

Context

Cyrus-IMAPd 3.8.3 JMAP server (username@example.org login works properly with Ltt.rs) Samsung Galaxy S23 Twake mail 0.11.4001 from the Google Play Store

Additional information

This happens every time.

The JSON response looks like the following except that the one that succeeds has username in place of username@example.org:

{
  "username": "username@example.org",
  "apiUrl": "/jmap/",
  "downloadUrl": "/jmap/download/{accountId}/{blobId}/{name}?accept={type}",
  "uploadUrl": "/jmap/upload/{accountId}/",
  "eventSourceUrl": "/jmap/eventsource/?types={types}&closeafter={closeafter}&ping={ping}",
  "state": "0",
  "capabilities": {
    "urn:ietf:params:jmap:core": {
      "maxSizeUpload": 1073741824,
      "maxConcurrentUpload": 5,
      "maxSizeRequest": 10485760,
      "maxConcurrentRequests": 5,
      "maxCallsInRequest": 50,
      "maxObjectsInGet": 4096,
      "maxObjectsInSet": 4096,
      "collationAlgorithms": []
    },
    "urn:ietf:params:jmap:mail": {},
    "urn:ietf:params:jmap:submission": {},
    "urn:ietf:params:jmap:vacationresponse": {},
    "urn:ietf:params:jmap:mdn": {},
    "urn:ietf:params:jmap:calendars": {},
    "urn:ietf:params:jmap:principals": {},
    "urn:ietf:params:jmap:calendars:preferences": {},
    "https://cyrusimap.org/ns/jmap/sieve": {},
    "https://cyrusimap.org/ns/jmap/admin": {}
  },
  "accounts": {
    "username@example.org": {
      "name": "username@example.org",
      "isPrimary": true,
      "isPersonal": true,
      "isReadOnly": false,
      "accountCapabilities": {
        "urn:ietf:params:jmap:core": {},
        "urn:ietf:params:jmap:mail": {
          "maxMailboxesPerEmail": 20,
          "maxKeywordsPerEmail": 100,
          "maxSizeAttachmentsPerEmail": 10485760,
          "emailsListSortOptions": [
            "receivedAt",
            "sentAt",
            "from",
            "id",
            "emailstate",
            "size",
            "subject",
            "to",
            "hasKeyword",
            "someInThreadHaveKeyword"
          ],
          "mayCreateTopLevelMailbox": true
        },
        "urn:ietf:params:jmap:submission": {
          "maxDelayedSend": 44236800,
          "submissionExtensions": {
            "size": [
              "50000000"
            ],
            "dsn": []
          }
        },
        "urn:ietf:params:jmap:mdn": {},
        "urn:ietf:params:jmap:calendars": {
          "minDateTime": "1901-12-13T20:45:53Z",
          "maxDateTime": "2038-01-19T03:14:06Z",
          "maxExpandedQueryDuration": "P365D",
          "maxParticipantsPerEvent": null,
          "mayCreateCalendar": true,
          "shareesActAs": "self",
          "maxCalendarsPerEvent": 1
        },
        "urn:ietf:params:jmap:principals": {
          "currentUserPrincipalId": "username@example.org",
          "urn:ietf:params:jmap:calendars": {
            "accountId": "username@example.org",
            "account": null,
            "mayGetAvailability": true,
            "sendTo": {
              "imip": "mailto:username@example.org"
            }
          }
        },
        "urn:ietf:params:jmap:principals:owner": {
          "accountIdForPrincipal": "username@example.org",
          "principalId": "username@example.org"
        },
        "urn:ietf:params:jmap:calendars:preferences": {},
        "https://cyrusimap.org/ns/jmap/sieve": {
          "supportsTest": true,
          "maxRedirects": null,
          "maxNumberScripts": 5,
          "maxSizeScript": 32768,
          "sieveExtensions": [
            "encoded-character",
            "comparator-i;ascii-numeric",
            "fileinto",
            "reject",
            "ereject",
            "vacation",
            "vacation-seconds",
            "notify",
            "enotify",
            "include",
            "editheader",
            "vnd.cyrus.snooze",
            "vnd.cyrus.imip",
            "envelope",
            "environment",
            "body",
            "imap4flags",
            "date",
            "ihave",
            "mailbox",
            "mboxmetadata",
            "servermetadata",
            "duplicate",
            "vnd.cyrus.jmapquery",
            "relational",
            "regex",
            "extlists",
            "subaddress",
            "copy",
            "index",
            "variables",
            "redirect-deliverby",
            "redirect-dsn",
            "special-use",
            "fcc",
            "mailboxid"
          ],
          "notificationMethods": [
            "mailto"
          ],
          "externalLists": [
            "urn:ietf:params:sieve:addrbook"
          ]
        },
        "urn:ietf:params:jmap:vacationresponse": {}
      }
    }
  },
  "primaryAccounts": {
    "urn:ietf:params:jmap:mail": "username@example.org",
    "urn:ietf:params:jmap:submission": "username@example.org",
    "urn:ietf:params:jmap:vacationresponse": "username@example.org",
    "urn:ietf:params:jmap:calendars": "username@example.org",
    "https://cyrusimap.org/ns/jmap/contacts": "username@example.org",
    "https://cyrusimap.org/ns/jmap/calendars": "username@example.org",
    "https://cyrusimap.org/ns/jmap/backup": "username@example.org",
    "https://cyrusimap.org/ns/jmap/sieve": "username@example.org",
    "urn:ietf:params:jmap:principals": "username@example.org"
  }
}
chibenwa commented 4 months ago

When I attempt to login to my Cyrus-IMAPd 3.8.3 server with my full username@example.org, the login on the server succeeds, but Twake mail reports "Unknown error occurred, please try again". When just using my username the app works properly.

This is more relevant to the way cyrus works that Twake mail.

Do your Cyrus set up support email address login in IMAP? Can you dig in why it would work in IMAP and not in JMAP?

The unknown error is likely a 401.

chibenwa commented 4 months ago

Double reading the comment it looks more like Twake mail is actually not able to handle cyrus response...

@hoangdat could you debug using a fastmail testing account please?

amessina commented 4 months ago

When I attempt to login to my Cyrus-IMAPd 3.8.3 server with my full username@example.org, the login on the server succeeds, but Twake mail reports "Unknown error occurred, please try again". When just using my username the app works properly.

This is more relevant to the way cyrus works that Twake mail.

Do your Cyrus set up support email address login in IMAP? Can you dig in why it would work in IMAP and not in JMAP?

The unknown error is likely a 401.

I log into my Cyrus-IMAPd server with my full usernam@example.org when using IMAP.

amessina commented 4 months ago

When I attempt to login to my Cyrus-IMAPd 3.8.3 server with my full username@example.org, the login on the server succeeds, but Twake mail reports "Unknown error occurred, please try again". When just using my username the app works properly.

This is more relevant to the way cyrus works that Twake mail.

Do your Cyrus set up support email address login in IMAP? Can you dig in why it would work in IMAP and not in JMAP?

The unknown error is likely a 401.

I can confirm that Cyrus return 200. No 401error.

hoangdat commented 4 months ago

With Fastmail account, Tmail still work (it is Bearer auth, not Basic Auth)

image image

I can not run a Cyrus instance, so I can not more details on the problem. Can you help me on Cyrus up and run? @chibenwa