Solving OneDrive File Access Issues in Ubuntu 24.04: A Practical Guide

Of the many new features in Ubuntu 24.04 LTS, it’s the ability to access OneDrive files through the Nautilus file manager as a remote mount that stands out.

This becomes a reality thanks to the msgraph package. This is a new gvfs backend that Nautilus can work with. Also in the mix are account integration through GNOME Online Accounts (GOA) and the relevant permissions and approvals from Microsoft.

Setting up the file-access feature might not be obvious at first, but it’s straightforward once you get the hang of it. The feature is compatible with both standard Microsoft OneDrive accounts as well as OneDrive accounts provided/managed by an organization, for instance, your workplace.

The solution is ‘turnkey’, which is excellent: it’s ready to use, straight out of the box. No need for third-party apps, scripts, or add-ons that require you to input your valuable account details.

But there is a really annoying issue with it: it doesn’t stay connected.

A right royal runaround

I can successfully add my Microsoft 365 account in Online Accounts without issue and slide the ‘Files’ toggle to enable the Nautilus OneDrive integration and it all works great.

But it only works until I shutdown or reboot.

Next time I log in and attempt to access OneDrive in Nautilus, I encounter an “invalid credentials” error. An issue is represented by a warning icon next to my Microsoft 365 account in Settings, which leads to an info bar advising me to reconnect.

However, the reconnection process is also unsuccessful. Despite being able to log in on Microsoft’s authorization page without any problems, the authorization pass back to GOA is prevented by an “invalid UTF-8” error.

The only solution I’ve found to activate the feature again is to completely remove my account from Online Accounts and set up everything again – every time I log in!

While this is not a significant problem, it can be a slight inconvenience when all I want to do is retrieve a file. (A bit of a “faff”, as the Brits would say).

How to Fix the Microsoft 365 Account Issue

Well, the good news is that the ‘invalid credentials’ issue that occurs between sessions is a bug and a fix has been merged upstream which I hope will filter down to Ubuntu 24.04 LTS soon.

In the meantime there’s a manual workaround to “solve” it.

If you are experiencing constant account reset issues and wish to maintain a consistent connection to your cloud account between sessions, follow these steps:

  • Locate and open the ~/.config/goa-1.0/accounts.conf file in a text editor.
  • Navigate to the OAuth2RedirectUri section.
  • Identify and copy the number string found after the localhost/ (this string is your client ID).
  • Proceed to the OAuth2ClientId section.
  • Exchange the [Invalid UTF-8] with the previously copied client ID.
  • Save the changes and reboot your computer.

Upon completing these steps, your Microsoft 365 account should remain authenticated and functional between sessions. This solution eliminates the need for constant reauthorization and removes the occurrence of “invalid credential” errors when you need to stash or retrieve files from OneDrive.

Hopefully, this solution proves useful for you!


Posted

in

, , , ,

by

Tags: