Home    |    GitHub Page    |    API    |    FAQ

Option to re-authenticate with OneDrive

For reference, support-category thread OneDrive Sync Question

Apparently it is necessary to completely backup and restore the entire Joplin database when a OneDrive authentication token is revoked or expires.

I would request a supported method of re-authenticating with OneDrive when Joplin's token is revoked or expires- as I mentioned in the other thread, backing up and restoring your entire database annually (when the OneDrive token expires) isn't really practical for production software.

Less important, but very useful, would be an option to choose which instance of OneDrive (business or personal) is used to authenticate. I don't know the details without looking into the OneDrive API, but certainly many apps do allow making this choice, and it would be a convenience.

Wow, I had no idea this would happen. After a disastrous trial and error with doing a file system sync over Google Drive I moved over to OneDrive. My DB is small so the 5GB free version is fine.

So, the token expires and there is no way around this?

Honestly, I have to say I was just waiting for something stupid like this from MS to happen. I've taken to exporting all my notebooks once a week, zipping them into a password protected 7Z file and placing that on my Google drive - just in case.

I did remove the sync.3.* entries in the 'settings' table, but Joplin still thinks OneDrive is configured. I haven't been able to find out what it's looking at, and thinking that OneDrive is still configured.

I completely removed ~/.config/joplin-desktop and restarted Joplin, but choosing OneDrive as the sync target does nothing. Joplin is not requesting a new authentication token or performing any action at all. The "sync.3.{path,context}" entries in the "settings" table are not being updated.

Any chance of getting a dev comment on this? Thanks!

Joplin version: 1.4.9.2933

After removing ~/.config/joplin-desktop, I get the following in the logs (with OneDrive selected as the sync target):

2020-11-13 11:35:07: "Synchroniser is missing credentials - manual sync required to authenticate."

What happens, if you click on Synchronize?

Previously it was just popping up a full-screen Developer Tools window every time I clicked "Synchronize", but I removed everything, re-installed again, and now it's prompting me to authenticate. However, it's still trying to authenticate against OneDrive Business. I've stopped the OneDrive business daemon and made sure that going to https://login.live.com and https://onedrive.com take me to my PERSONAL OneDrive account (which they do).

I see that MS has documentation on obtaining an application token here:
https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/msa-oauth?view=odsp-graph-online

Do you know what method Joplin is using, so I can figure out how to stop it from trying to authenticate against the Business account?

Thanks!

For the record, Joplin uses this URL:
https://login.microsoftonline.com

You will find that it takes you to a different logged-in session than either:

https://login.live.com
or
https://onedrive.com

If you are having problems with Joplin syncing to the wrong OneDrive instance (business vs. personal), make sure you log out after going to the first URL listed above.

Unfortunaetly I have no idea how the authentication with OneDrive works.

I think the business code was added a few weeks (or maybe months) ago, so it could be that there was an oversight.

I think jonath92 is @johnny on this forum....

I think jonath92 is @johnny on this forum....

Yes that's true. Actually the authentication used for onedrive for Business and onedrive for Personal is basically the same. I think @wandern is right with the URLs. It seems that there are two URLs which can be used to get the authentication Tokens from the onedrive api: https://login.microsoftonline.com and
https://login.live.com. The first one is used by joplin. This is has been already the case before I made the pull request for Onedrive for Business. But if you use this URL and you are logged in to a Business Account in office.com joplin automatically uses the Token from your Business Account when you click om the link even when you are logged in to your Personal Account at onedrive.com. However if you are not logged in to your Business Account at offife.com you can log in to your Personal or your Business Account. This is really confusing. So as far as I can see joplin basically has always used the "wrong" url for onedrive Personal. I am actually suprised that this hasn't been reported before. I think we need to have an option for onedrive Personal and onedrive for Business in the settings menu. I might make a pr for this when i find time. So propably not in the next 2 weeks

1 Like

@johnny - your notes confirm my observations.