abraunegg / onedrive

OneDrive Client for Linux
https://abraunegg.github.io
GNU General Public License v3.0
10.09k stars 863 forks source link

Bug: Unable to query OneDrive API to obtain required account details #2941

Open laf0rge opened 1 day ago

laf0rge commented 1 day ago

Describe the bug

I would like to use this software to synchronize files from a business sharepoint site to my local machine. I can access the https://undisclosed-site.sharepoint.com/ via the web browser just fine.

However, when I want to use this software, after the initial authentication it always fails like this:

Using IPv4 and IPv6 (if configured) for all network operations
Attempting to contact Microsoft OneDrive Login Service
Successfully reached Microsoft OneDrive Login Service
Configuring Global Azure AD Endpoints
Unable to query OneDrive API to obtain required account details

I think this may be related to the fact that my account has no [personal] OneDrive or Office 365 at all. It only has access to that sharepoint instance.

The oauth first seems to succeed but then the GET to /v1.0/me/drive fails with HTTP status 400.

Operating System Details

Debian GNU/Linux unstable / kernel 6.11.4-amd64

Client Installation Method

From Distribution Package

OneDrive Account Type

SharePoint

What is your OneDrive Application Version

onedrive v2.5.2-1

What is your OneDrive Application Configuration

Application version                          = onedrive v2.5.2-1
Compiled with                                = LDC 2106
User Application Config path                 = /crypt/space/home/laforge/.config/onedrive
System Application Config path               = /etc/onedrive
Applicable Application 'config' location     = /crypt/space/home/laforge/.config/onedrive/config
Configuration file found in config location  = false - using application defaults
Applicable 'sync_list' location              = /crypt/space/home/laforge/.config/onedrive/sync_list
Applicable 'items.sqlite3' location          = /crypt/space/home/laforge/.config/onedrive/items.sqlite3
Config option 'drive_id'                     = 
Config option 'sync_dir'                     = ~/OneDrive
Config option 'enable_logging'               = false
Config option 'log_dir'                      = /var/log/onedrive
Config option 'disable_notifications'        = false
Config option 'skip_dir'                     = 
Config option 'skip_dir_strict_match'        = false
Config option 'skip_file'                    = ~*|.~*|*.tmp|*.swp|*.partial
Config option 'skip_dotfiles'                = false
Config option 'skip_symlinks'                = false
Config option 'monitor_interval'             = 300
Config option 'monitor_log_frequency'        = 12
Config option 'monitor_fullscan_frequency'   = 12
Config option 'read_only_auth_scope'         = false
Config option 'dry_run'                      = false
Config option 'upload_only'                  = false
Config option 'download_only'                = false
Config option 'local_first'                  = false
Config option 'check_nosync'                 = false
Config option 'check_nomount'                = false
Config option 'resync'                       = false
Config option 'resync_auth'                  = false
Config option 'cleanup_local_files'          = false
Config option 'classify_as_big_delete'       = 1000
Config option 'disable_upload_validation'    = false
Config option 'disable_download_validation'  = false
Config option 'bypass_data_preservation'     = false
Config option 'no_remote_delete'             = false
Config option 'remove_source_files'          = false
Config option 'sync_dir_permissions'         = 700
Config option 'sync_file_permissions'        = 600
Config option 'space_reservation'            = 52428800
Config option 'application_id'               = d50ca740-c83f-4d1b-b616-12c519384f0c
Config option 'azure_ad_endpoint'            = 
Config option 'azure_tenant_id'              = 
Config option 'user_agent'                   = ISV|abraunegg|OneDrive Client for Linux/v2.5.2-1
Config option 'force_http_11'                = false
Config option 'debug_https'                  = false
Config option 'rate_limit'                   = 0
Config option 'operation_timeout'            = 3600
Config option 'dns_timeout'                  = 60
Config option 'connect_timeout'              = 10
Config option 'data_timeout'                 = 60
Config option 'ip_protocol_version'          = 0
Config option 'threads'                      = 8
Environment var 'XDG_RUNTIME_DIR'            = true
Environment var 'DBUS_SESSION_BUS_ADDRESS'   = true
Config option 'notify_file_actions'          = false

Selective sync 'sync_list' configured        = false

Config option 'sync_business_shared_items'   = false

Config option 'webhook_enabled'              = false

What is your 'curl' version

curl 8.10.1 (x86_64-pc-linux-gnu) libcurl/8.10.1 GnuTLS/3.8.6 zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libpsl/0.21.2 libssh2/1.11.1 nghttp2/1.63.0 ngtcp2/1.6.0 nghttp3/1.4.0 librtmp/2.3 OpenLDAP/2.5.18
Release-Date: 2024-09-18, security patched: 8.10.1-2
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

Where is your 'sync_dir' located

Local

What are all your system 'mount points'

sorry, not relevant here

What are all your local file system partition types

sorry, not relevant here

How do you use 'onedrive'

intended use is just to sync some sharepoint folders.

Steps to reproduce the behaviour

onedrive --get-sharepoint-drive-id membergateway.sharepoint.com

Complete Verbose Log Output

> GET /v1.0/me/drive HTTP/2
Host: graph.microsoft.com
User-Agent: ISV|abraunegg|OneDrive Client for Linux/v2.5.2-1
Accept: */*
Authorization: bearer <UNDISCLOSED>

* Request completely sent off
< HTTP/2 400 
< content-type: application/json
< strict-transport-security: max-age=31536000
< request-id: bca49fcb-8137-403d-ae21-4da4d53f95e1
< client-request-id: bca49fcb-8137-403d-ae21-4da4d53f95e1
< x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"Japan East","Slice":"E","Ring":"5","ScaleUnit":"002","RoleInstance":"TY2PEPF00008863"}}
< date: Fri, 01 Nov 2024 01:28:47 GMT
< 
* Connection #1 to host graph.microsoft.com left intact
Unable to query OneDrive API to obtain required account details

Screenshots

No response

Other Log Information or Details

No response

Additional context

I have never used nor any intention to use any other microsoft services than this business sharepoint.

abraunegg commented 1 day ago

@laf0rge Please can you provide:

Whilst your non-verbose log is showing an error, I need to see and trace through where and why and if something can be done for your scenario.

You may also need to investigate having the owner of the sharepoint site provide a few more permissions for your account to allow some of these queries to occur - which sets up a number of things in the way the application works internally.

abraunegg commented 21 hours ago

@laf0rge Please can you test PR #2943 to potentially resolve your issue. Your debug logs may still be required if this does not resolve your issue.

First install all the required platform dependencies to build the client on your respective platforms. Please read https://github.com/abraunegg/onedrive/blob/master/docs/install.md#building-from-source---high-level-requirements and then follow correctly for your platform.

Once this is done, to clone the PR to resolve your issue, you can use a script like the following:

#!/bin/bash

PR=2943

rm -rf ./onedrive-pr${PR}
git clone https://github.com/abraunegg/onedrive.git onedrive-pr${PR}
cd onedrive-pr${PR}
git fetch origin pull/${PR}/head:pr${PR}
git checkout pr${PR}

# Configure and Build
./configure --enable-debug --enable-notifications; make clean; make;
./onedrive --version

This script will create a local folder called onedrive-pr2943 with the PR version.

To run the PR, you need to run the client from the PR build directory:

./onedrive <any other options needed>

To install the PR, you will need to perform sudo make install to install the PR version to your system.

When running the PR, your version should be: onedrive v2.5.2-29-gd42bbfd or greater.

abraunegg commented 7 hours ago

@laf0rge Please can you respond