OneDrive: backups fail for personal accounts, accounts have no name and can be duplicated, sign-in reuses the browser's Microsoft session

REPRODUCIBILITY: 100 %
OS VERSION: 5.2.0.22
HARDWARE: Jolla Phone 2026
UI LANGUAGE: French
REGRESSION: Yes, since Microsoft retired the Live Connect API (apis.live.net); backups to personal accounts probably never worked

DESCRIPTION:

Three OneDrive problems, all reproducible. I found the causes and have fixes running on my device.

1. Backups to a personal OneDrive account always fail. Settings → Backup → Back up now always ends with “Error: unable to transfer the file”. Work/school (Entra ID) accounts work.
Cause: buteo-sync-plugins-social sends Authorization: Bearer with the chunk PUT requests to the pre-authenticated uploadUrl of the upload session. Consumer OneDrive answers 401 Unauthenticated, as Microsoft’s documentation warns; OneDrive for Business tolerates it.
Fix: pull request onedrive: Do not send Authorization header with upload session chunks by Creteil · Pull Request #23 · sailfishos/buteo-sync-plugins-social · GitHub (2 lines).

2. New OneDrive accounts have no name, and the same account can be added several times. Accounts shows no user name. Backup shows every OneDrive account as just “OneDrive”, so with two of them you cannot tell which is which. The duplicate check in onedrive.qml (“You have already added a OneDrive account for user %1”) never triggers.
Cause: after sign-in, /usr/share/accounts/ui/onedrive.qml identifies the user with https://apis.live.net/v5.0/me. That is the retired Live Connect API, which now returns HTTP 400. On a non-200 reply the code continues (accountSetup.done()), so:

  • default_credentials_username and default_credentials_id are never set: no account name. The Backup page builds its label “OneDrive (name)” from that user name.
  • The duplicate check compares the empty default_credentials_id, so it never matches.
  • An anonymous account is created silently.

3. Adding a OneDrive account silently signs in with whatever Microsoft session the Sailfish Browser has (e.g. a work account used in the browser). The intended account cannot be chosen, and you get a duplicate of the other account.
Cause: onedrive.provider uses ExternalBrowser = true, and the authorization request has no prompt parameter.

PRECONDITIONS:

  • A personal Microsoft account (for 1).
  • For 3: a Microsoft session already open in the Sailfish Browser, for another account.

STEPS TO REPRODUCE:

  1. Settings → Accounts → Add account → OneDrive, sign in with a personal Microsoft account.
  2. Look at the new account in Accounts and in Settings → Backup.
  3. Settings → Backup → Back up now to this account.
  4. Add OneDrive again with the same Microsoft account.

EXPECTED RESULT:

  • The account shows its user name in Accounts and Backup.
  • The backup completes.
  • Adding the same account again is refused.
  • Microsoft lets me choose which account to sign in with.

ACTUAL RESULT:

  • No name: just “OneDrive”, in both places.
  • The backup fails with “unable to transfer the file”. The journal shows HTTP code: 401 ... "unauthenticated" from buteo-oopp-runner.
  • A second, identical, nameless account is created.
  • With a Microsoft session in the browser, it signs in with that account without asking.

MODIFICATIONS:

  • Patchmanager: yes, my own patch of onedrive.qml to test the fix for 2 and 3 (described below). The problems were reproduced before it was installed.
  • buteo-sync-plugins-social 0.4.33 rebuilt with the change from the PR above.

ADDITIONAL INFORMATION:

Suggested fix for 2 and 3. This is what my Patchmanager patch of onedrive.qml does, tested on 5.2.0.22:

  1. A page asks for the Microsoft account address before opening the browser. An address already used by a OneDrive account is refused there.
  2. The sign-in session uses what signon-plugin-oauth2 already supports: ExtraParams, added by Jolla in 2022 so that Microsoft prompts for the account. It also adds the User.Read scope:
var sessionData = {
    "ClientId": ...,
    "ClientSecret": ...,
    "Scope": ["offline_access", "files.readwrite", "User.Read"],
    "ExtraParams": { "prompt": "select_account", "login_hint": email }
}
  1. After sign-in, the user is identified with Microsoft Graph GET https://graph.microsoft.com/v1.0/me (id, mail / userPrincipalName). The new account is removed, with an error shown, if:
    • Graph fails;
    • the signed-in address differs from the one typed;
    • the Microsoft user id already belongs to another OneDrive account.
  2. default_credentials_id, the address and a display label are stored. Accounts and Backup now show the same name.

Results:

  • Personal and work accounts both work, side by side, each with its own name, and with an account picker instead of silent sign-in.
  • The same address is refused before any browser opens.
  • Backups to the personal account complete, together with the PR above.

I can share the Patchmanager patch if useful. Ideally these changes would go into jolla-settings-accounts-extensions-onedrive.

2 Likes

Update: OneDrive in the Gallery — six more problems found, causes and fixes

After the backup and account fixes above, I looked at OneDrive in the Gallery on my Jolla Phone 2026 (5.2.0.22). Six problems, all with a cause found and a fix running on my device for several hours now.

4. Full-size photos never open (“Download failed”) with a personal Microsoft account. Thumbnails show, but every photo fails when opened.
Cause: the image url is graph.microsoft.com/v1.0/me/drive/items/<id>/content, which redirects to a pre-authenticated my.microsoftpersonalcontent.com/.../download.aspx?...tempauth=.... AbstractImageDownloader (libsocialcache) follows the redirect itself and sends the Authorization: Bearer header again, which that host rejects: 401 {"error":{"code":"unauthenticated"}}. Same root cause as the backup problem (1).
Fix: abstractimagedownloader: Do not forward the access token on cross-host redirects by Creteil · Pull Request #7 · sailfishos/libsocialcache · GitHub — the token is not forwarded on a redirect to another host.

5. Thumbnails turn grey some time after a sync, and stay grey.
Cause: the sync stores the thumbnail url returned by the listing. That url is pre-authenticated and expires after about an hour. The gallery only downloads a thumbnail when it is first displayed, and the stored url is never refreshed (the row is only rewritten when the photo changes).
Fix: onedrive: Store stable thumbnail urls and download thumbnails during sync by Creteil · Pull Request #24 · sailfishos/buteo-sync-plugins-social · GitHub — the sync now downloads the thumbnails itself, and stores the stable Graph url (/me/drive/items/<id>/thumbnails/0/medium/content) instead of the expiring one. With onedrive: Send the access token when downloading Graph thumbnail urls by Creteil · Pull Request #8 · sailfishos/libsocialcache · GitHub, the gallery can also fetch a missing thumbnail through that url, with the account’s token. Thumbnails of PNG screenshots are now saved as .png (the gallery could not show them as .jpg).

6. Two OneDrive accounts look identical in the Gallery. With a personal and a work account, both are listed under the same Microsoft display name.
Fix: onedrive: Label gallery users like their account by Creteil · Pull Request #25 · sailfishos/buteo-sync-plugins-social · GitHub — the gallery user is labelled like the account in Settings → Accounts.

7. Some full-size photos keep spinning forever (intermittent, mostly after the first photo).
Cause, found with debug logs: AccessTokensProvider.qml (jolla-gallery-extensions) returns a cached access token synchronously from requestAccessToken(). When that happens while the CloudImage delegate is still being created, its Connections { target: accessTokensProvider } is not connected yet, the accessTokenRetrieved signal is lost, and the photo waits forever. AccessTokensProvider also ignores signInError, so a failed sign-in waits forever too.
Suggested fix (applies to Dropbox as well): defer the request in CloudImage.requestAccessToken() by one event loop turn (a Timer { interval: 0 }, since Qt 5.6 has no Qt.callLater), and handle signInError in AccessTokensProvider. Tested: 52 photos opened in a row, none stuck.

8. No pinch-to-zoom on online photos (OneDrive, Dropbox). CloudImage.qml shows a plain Image (“No point to load more than this until we implement zooming”), while Nextcloud photos already use ImageViewer.
Suggested fix: use ImageViewer in CloudImage.qml, as NextcloudFullscreenPhotoPage.qml does. Pinch, double tap and full-resolution loading on zoom then work like for local photos.

9. Long account names overflow the screen on the Gallery accounts page: in UserDelegate.qml the title label is only anchored on the right, so a long name goes past the left edge, and elide never applies. Suggested fix: anchor it on both sides (and fontSizeMode: Text.HorizontalFit).

Items 7 to 9 are in closed components, so I can only offer them as Patchmanager patches; I can share the diffs if Jolla or anyone wants them.

All tested on a Jolla Phone 2026, Sailfish OS 5.2.0.22, with a personal and a work OneDrive account.