rclone: Proton Drive: error 422 due to authenticating using an empty access token?
What is the problem you are having with rclone?
Can’t access Proton Drive. I get an HTTP error 422.
What is your rclone version (output from rclone version)
michal@dzieni ~ % rclone version
rclone v1.66.0
- os/version: darwin 14.3.1 (64 bit)
- os/kernel: 23.3.0 (arm64)
- os/type: darwin
- os/arch: arm64 (ARMv8 compatible)
- go/version: go1.22.1
- go/linking: dynamic
- go/tags: none
Which OS you are using and how many bits (e.g. Windows 7, 64 bit)
macOS 14.3.1 (23D60), 64-bit
Which cloud storage system are you using? (e.g. Google Drive)
Proton Drive
The command you were trying to run (e.g. rclone copy /tmp remote:tmp)
rclone lsd proton:
A log from the command with the -vv flag (e.g. output from rclone -vv copy /tmp remote:tmp)
michal@dzieni ~ % rclone lsd proton: -vv
2024/05/23 17:06:37 DEBUG : rclone: Version "v1.66.0" starting with parameters ["rclone" "lsd" "proton:" "-vv"]
2024/05/23 17:06:37 DEBUG : Creating backend with remote "proton:"
2024/05/23 17:06:37 DEBUG : Using config file from "/Users/michal/.config/rclone/rclone.conf"
2024/05/23 17:06:37 DEBUG : proton drive root link ID '': Has cached credentials
2024/05/23 17:06:37.378288 WARN RESTY 401 GET https://mail.proton.me/api/core/v4/users: Invalid access token (Code=401, Status=401), Attempt 1
2024/05/23 17:06:37.378431 ERROR RESTY 401 GET https://mail.proton.me/api/core/v4/users: Invalid access token (Code=401, Status=401)
2024/05/23 17:06:37.484298 WARN RESTY 422 POST https://mail.proton.me/api/auth/v4/refresh: Invalid refresh token (Code=10013, Status=422), Attempt 1
2024/05/23 17:06:37.484350 ERROR RESTY 422 POST https://mail.proton.me/api/auth/v4/refresh: Invalid refresh token (Code=10013, Status=422)
2024/05/23 17:06:37 DEBUG : Saving config "client_uid" in section "proton" of the config file
2024/05/23 17:06:37 DEBUG : Saving config "client_access_token" in section "proton" of the config file
2024/05/23 17:06:37 DEBUG : Saving config "client_refresh_token" in section "proton" of the config file
2024/05/23 17:06:37 DEBUG : Saving config "client_salted_key_pass" in section "proton" of the config file
2024/05/23 17:06:37 DEBUG : proton drive root link ID '': Cached credential doesn't work, clearing and using the fallback login method
2024/05/23 17:06:37 DEBUG : Saving config "client_uid" in section "proton" of the config file
2024/05/23 17:06:37 DEBUG : Saving config "client_access_token" in section "proton" of the config file
2024/05/23 17:06:37 DEBUG : Saving config "client_refresh_token" in section "proton" of the config file
2024/05/23 17:06:37 DEBUG : Saving config "client_salted_key_pass" in section "proton" of the config file
2024/05/23 17:06:37 DEBUG : proton drive root link ID '': couldn't initialize a new proton drive instance using cached credentials: failed to refresh auth: failed to refresh auth, de-auth: 422 POST https://mail.proton.me/api/auth/v4/refresh: Invalid refresh token (Code=10013, Status=422)
2024/05/23 17:06:37 DEBUG : proton drive root link ID '': Using username and password to log in
2024/05/23 17:06:38.566218 WARN RESTY 422 POST https://mail.proton.me/api/auth/v4: We are detecting potentially abusive traffic coming from your network and have temporarily blocked logins. If you believe this is in error, please contact us here: https://proton.me/support/appeal-abuse (Code=2028, Status=422), Attempt 1
2024/05/23 17:06:38.566270 ERROR RESTY 422 POST https://mail.proton.me/api/auth/v4: We are detecting potentially abusive traffic coming from your network and have temporarily blocked logins. If you believe this is in error, please contact us here: https://proton.me/support/appeal-abuse (Code=2028, Status=422)
2024/05/23 17:06:38 Failed to create file system for "proton:": couldn't initialize a new proton drive instance: 422 POST https://mail.proton.me/api/auth/v4: We are detecting potentially abusive traffic coming from your network and have temporarily blocked logins. If you believe this is in error, please contact us here: https://proton.me/support/appeal-abuse (Code=2028, Status=422)
Thoughts
Here is a config for this remote:
[proton]
type = protondrive
username = SECRET
password = SECRET
I think the problem is following:
- The app believes that there are cached OAuth credentials (which is not true) and tries to authenticate with empty values.
- The request gets rejected (401).
- The app falls back to username & password auth.
- It doesn’t work though, because the previous attempts lead to marking the traffic as suspicious.
I believe if the app had started immediately with username & password auth, it would be just fine.
How to use GitHub
- Please use the 👍 reaction to show that you are affected by the same issue.
- Please don’t comment if you have no relevant information to add. It’s just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 29
- Comments: 20 (4 by maintainers)
Feels like Proton might be blocking rclone based on the app version. I’m running daily backups with pure rclone as well as my own implementation done with https://github.com/henrybear327/Proton-API-Bridge, both has been failing for the past 3 days.
If I keep the original app version of
macos-drive@1.0.0-alpha.1+rcloneI get blocked withWe are detecting potentially abusive traffic coming from your network and have temporarily blocked logins.etcIf I remove
+rclonein the app version I can immediately login from both rclone and my own implementation.I think you mean removing
+rclonefrom the app version maybe? This worked for me:Thanks for figuring this out!
I have found that this issue a) persists and b) might be much less complicated than it appears.
First of all, having ‘rclone’ in the app-name string does not seem to cause any problems, or at least not anymore:
Secondly, I have found
in my rclone config after the failed login attempt, which is obviously done by rclone, not Proton.
If there is a connection problem, in my case a simple timeout, the session info is wiped by rclone. I assume this is done to rule out that the problem is with the session, rather than something else. However, this does not work well at all in the case of Proton!
In sum, I think at leat for Proton, rclone should reconsider the session info wipes. It seriously negatively impacts the user experience of anyone using 2FA (which should be anyone 😛) and even more so if you use any VPN.
I’ve contacted Proton using URL received in the error and that’s their response:
Does that mean that Proton offically bans rclone? 😞
Here is my response, hopefully we can fix it:
I moved to Filen.io and am happy.
@thawthorn Yeah! I thought that’s what I said, sorry if I worded it badly 😛 Glad it worked for you as well
Edit: Ohhhh, now I see what you mean. Updated my original answer, thanks for pointing it out!
I got the same problem at basically the same time. I could imagine that it is Proton blocking rclone. I would be interested to know if anyone has managed to log in with rclone in the last time.
Additionally I am able to log into the Proton webapp and the security log contains a blocked “Sign in attempt” from “
macos-drive 1.0.0-alpha.1+rclone”.@fhoekstra I don’t see why not. Basically all they do is take your
.confexactly as is and backup/restore it.pre_sync.fishwill create a backup of the.confif there is a session ID found. If this is not the case, it will attempt to restore from an existing backup, given there is one and it contains a session ID.post_sync.fishis a bit more complex. It creates a hook that will be executed after whatever background process is started before it (using the$last_pidvariable that is built intofish).What is does is creating/refreshing your backup if it reads exit code 0. If it detects a non-zero exit, it will test whether your current
.confstill holds a session ID. If this is not the case, it will look for a backup. If there is one and it contains a session ID, it will restore it.So far, I haven’t experienced any issue while running
resticbackups andrclone bisyncs with these scripts in place. However, I want to stress that it’s just a quick-n-dirty solution I came up with! I am not working on this project in any official capacity.I use some fish scripts that backup and restore the config as needed atm:
pre_sync.fishpost_sync.fishUsage:
Adjust paths as needed.
Note that this will only work on Linux (or with WSL, Cygwin) and if you have fish shell installed. If you do, you should be able to execute such a script like any other.
I solved the problem by using this: --protondrive-app-version “macos-drive@1.0.0-alpha.1” as suggested.
The second problem now, at least for me, is that i can’t upload files. Rclone says that the proton client is outdated in the logs. Anyone else?