Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

onedrive: errorHandler for business requests

Henning Surmeierf1269dc06a86
diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.go
index 09399d603..e9e34e165 100644
--- a/backend/onedrive/onedrive.go
+++ b/backend/onedrive/onedrive.go
@@ -97,7 +97,15 @@ func init() {
log.Fatalf("Failed to configure token: %v", err)
}
} else {
- err := oauthutil.Config("onedrive", name, oauthBusinessConfig, oauthBusinessResource)
+ err := oauthutil.ConfigErrorCheck("onedrive", name, func(req *http.Request) oauthutil.AuthError {
+ var resp oauthutil.AuthError
+
+ resp.Name = req.URL.Query().Get("error")
+ resp.Code = strings.Split(req.URL.Query().Get("error_description"), ":")[0] // error_description begins with XXXXXXXXXXXX:
+ resp.Description = strings.Join(strings.Split(req.URL.Query().Get("error_description"), ":")[1:], ":")
+ resp.HelpURL = "https://rclone.org/onedrive/#troubleshooting"
+ return resp
+ }, oauthBusinessConfig, oauthBusinessResource)
if err != nil {
log.Fatalf("Failed to configure token: %v", err)
return