mirror of
https://github.com/rclone/rclone.git
synced 2025-01-13 20:38:12 +02:00
gphotos: fix read only scope not being used properly
Before this change the read only scope was being ignored and rclone was asking for a read-write scope. https://forum.rclone.org/t/google-photos-copy-sync-errors/25153
This commit is contained in:
parent
11d86c74b2
commit
d38f6bb0ab
@ -53,6 +53,7 @@ const (
|
|||||||
minSleep = 10 * time.Millisecond
|
minSleep = 10 * time.Millisecond
|
||||||
scopeReadOnly = "https://www.googleapis.com/auth/photoslibrary.readonly"
|
scopeReadOnly = "https://www.googleapis.com/auth/photoslibrary.readonly"
|
||||||
scopeReadWrite = "https://www.googleapis.com/auth/photoslibrary"
|
scopeReadWrite = "https://www.googleapis.com/auth/photoslibrary"
|
||||||
|
scopeAccess = 2 // position of access scope in list
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -61,7 +62,7 @@ var (
|
|||||||
Scopes: []string{
|
Scopes: []string{
|
||||||
"openid",
|
"openid",
|
||||||
"profile",
|
"profile",
|
||||||
scopeReadWrite,
|
scopeReadWrite, // this must be at position scopeAccess
|
||||||
},
|
},
|
||||||
Endpoint: google.Endpoint,
|
Endpoint: google.Endpoint,
|
||||||
ClientID: rcloneClientID,
|
ClientID: rcloneClientID,
|
||||||
@ -89,9 +90,9 @@ func init() {
|
|||||||
case "":
|
case "":
|
||||||
// Fill in the scopes
|
// Fill in the scopes
|
||||||
if opt.ReadOnly {
|
if opt.ReadOnly {
|
||||||
oauthConfig.Scopes[0] = scopeReadOnly
|
oauthConfig.Scopes[scopeAccess] = scopeReadOnly
|
||||||
} else {
|
} else {
|
||||||
oauthConfig.Scopes[0] = scopeReadWrite
|
oauthConfig.Scopes[scopeAccess] = scopeReadWrite
|
||||||
}
|
}
|
||||||
return oauthutil.ConfigOut("warning", &oauthutil.Options{
|
return oauthutil.ConfigOut("warning", &oauthutil.Options{
|
||||||
OAuth2Config: oauthConfig,
|
OAuth2Config: oauthConfig,
|
||||||
|
Loading…
Reference in New Issue
Block a user