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

gphotos: fix read only scope not being used properly

Nick Craig-Woodd38f6bb0abd7
diff --git a/backend/googlephotos/googlephotos.go b/backend/googlephotos/googlephotos.go
index 7019eee29..d78af509f 100644
--- a/backend/googlephotos/googlephotos.go
+++ b/backend/googlephotos/googlephotos.go
@@ -53,6 +53,7 @@ const (
minSleep = 10 * time.Millisecond
scopeReadOnly = "https://www.googleapis.com/auth/photoslibrary.readonly"
scopeReadWrite = "https://www.googleapis.com/auth/photoslibrary"
+ scopeAccess = 2 // position of access scope in list
)
var (
@@ -61,7 +62,7 @@ var (
Scopes: []string{
"openid",
"profile",
- scopeReadWrite,
+ scopeReadWrite, // this must be at position scopeAccess
},
Endpoint: google.Endpoint,
ClientID: rcloneClientID,
@@ -89,9 +90,9 @@ func init() {
case "":
// Fill in the scopes
if opt.ReadOnly {
- oauthConfig.Scopes[0] = scopeReadOnly
+ oauthConfig.Scopes[scopeAccess] = scopeReadOnly
} else {
- oauthConfig.Scopes[0] = scopeReadWrite
+ oauthConfig.Scopes[scopeAccess] = scopeReadWrite
}
return oauthutil.ConfigOut("warning", &oauthutil.Options{
OAuth2Config: oauthConfig,