Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
laf0rge opened this issue Nov 1, 2024 · 10 comments · Fixed by #2943
Closed

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

laf0rge opened this issue Nov 1, 2024 · 10 comments · Fixed by #2943
Labels
Milestone

Comments

@laf0rge
Copy link

laf0rge commented Nov 1, 2024

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.

@laf0rge laf0rge added the Bug Something isn't working label Nov 1, 2024
@abraunegg
Copy link
Owner

@laf0rge
Please can you provide:

  • a complete verbose log output
  • a complete verbose debug log via email

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
Copy link
Owner

@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
Copy link
Owner

@laf0rge
Please can you respond

@laf0rge
Copy link
Author

laf0rge commented Nov 2, 2024 via email

@laf0rge
Copy link
Author

laf0rge commented Nov 2, 2024

The -v output looks as follows:

Using 'user' configuration path for application config and state data: /crypt/space/home/laforge/.config/onedrive
WARNING: D-Bus message bus daemon is not available; GUI notifications are disabled
Using IPv4 and IPv6 (if configured) for all network operations
Attempting to contact Microsoft OneDrive Login Service
Successfully reached Microsoft OneDrive Login Service
Checking Application Version ...
Attempting to initialise the OneDrive API ...
Configuring Global Azure AD Endpoints
The OneDrive API was initialised successfully
Opening the item database ...
Unable to query OneDrive API to obtain required account details

I'll pass along the -v -v one per e-mail as requested.

@abraunegg
Copy link
Owner

@laf0rge
Is this done via the PR version or standard v2.5.2 ?

@laf0rge
Copy link
Author

laf0rge commented Nov 2, 2024

the above was still done via 2.5.2. The PR related feedback was added to the PR. The debug logs (bothe debian 2.5.2 + your PR-branch) are sent by personal email to you.

@abraunegg
Copy link
Owner

@laf0rge
Please can you re-try the PR only.

When running this PR, you should be using onedrive v2.5.2-33-g42a7bdb or greater.

@abraunegg
Copy link
Owner

@laf0rge or future readers

When using the PR for this problem, the following application output is generated:

No user or system config file found, using application defaults
Using 'user' configuration path for application config and state data: /crypt/space/home/laforge/.config/onedrive
Using IPv4 and IPv6 (if configured) for all network operations
Attempting to contact Microsoft OneDrive Login Service
Successfully reached Microsoft OneDrive Login Service
Checking Application Version ...
Attempting to initialise the OneDrive API ...
Configuring Global Azure AD Endpoints
The OneDrive API was initialised successfully
Opening the item database ...
NO SYNC OR MONITOR TASK
FLAGGING AS NO SYNC OR MONITOR TASK FOR getDefaultDriveDetails
defaultOneDriveDriveDetails: null
NO SYNC TASK DO NOT THOW A AccountDetailsException
FLAGGING AS NO SYNC OR MONITOR TASK FOR getDefaultRootDetails
defaultOneDriveRootDetails: null
NO SYNC TASK DO NOT THOW A AccountDetailsException
Application Version:  onedrive v2.5.2-33-g42a7bdb
Account Type:         
Default Drive ID:     
Default Root ID:      
Remaining Free Space: 0 KB
Sync Engine Initialised with new Onedrive API instance

Office 365 Library Name Query: sharepoint.site.name
ERROR: Query of OneDrive for Office 365 Library Name failed

ERROR: Microsoft OneDrive API returned an error with the following message:
  Error Message:    HTTP request returned status code 400 (Bad Request)
  Error Reason:     Tenant does not have a SPO license.
  Error Code:       BadRequest
  Error Timestamp:  2024-11-03T23:29:53
  API Request ID:   4a76893a-d4f9-4513-ae0f-1aefc4b8fc06
  Calling Function: querySiteCollectionForDriveID()

At this point, there are potentially only one further option to try which is to add azure_tenant_id to a configuration file as per https://github.com/abraunegg/onedrive/blob/master/docs/application-config-options.md#azure_tenant_id and retest.

If this still fails with this specific entry, the client is unable to support this type of connection to a SharePoint site where there is no SharePoint License associated as to query all the Graph API endpoints it needs this.

Why this does work when simply using a web browser I do not know, as the web browser uses AFAIK the same Microsoft Graph API to render the content.

Closing this issue as unable to support any further, unless @laf0rge can test the 'azure_tenant_id' configuration which is the last resort.

@abraunegg
Copy link
Owner

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Repository owner locked as resolved and limited conversation to collaborators Nov 13, 2024
@abraunegg abraunegg added the OneDrive API Limitation OneDrive API Limitation label Nov 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants