You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[feature request] add support for 2FA in mailru backend #3637
Mailru backend fails to authorize if two-factor authentication is enabled on user account.
Also, if you try to use passwords that mail.ru generate specially for authorizing apps - you will get the following error: Failed to create file system for "XXX:": Failed to authorize: oauth2: server response missing access_token
Checked on Windows with Rclone version 1.49.5.
By the password for apps I actually meant this pass, that appears after you connect your 2FA app to mail.ru:
It appears to be randomly generated 16 digit pass,
btw, thank you for your great work on integrating mail.ru in Rclone.
I tried to create a test "social" app using your links (http://my.mail.ru/apps/766346) and perform app authorization. Their authorization method requires a browser-based application that is able to capture page loads in subframe. The first redirect during authorization goes to url under mailru refusing to redirect to rclone's localhost url for rclone to capture authorization code. Looks like their "social" app type is not intended for computer based applications, so the problem is not about 2FA (SMS backed user login) alone. This needs further investigation.
Let's summarize current findings on 2FA and 3rd party apps support in mailru. This can be later added in the backend docs.
A single account is used for the webmail and storage (aka "cloud") services. Only e-mail accounts belonging to Mailru company domains (@mail.ru, @list.ru, @bk.ru, etc) are fully supported. Their online help states that one can use an external (@yandex.ru etc) email but needs to register it with the Mailru mail in advance. In practice this is not generally recommended as it may involve additional OAUTH redirects, not yet tested in rclone. Account registration process is described in the online help (https://help.mail.ru/engmail-help/registration/signup).
configure 3rd party OTP application with reserved OTP codes (unrelated to rclone or mail, just codes)
configure 3rd party mail application with an "app code" (see below)
The code is bound to active 2FA and intended for consumption only by mobile mail applications like TheBat or alike to obtain a token, but cannot be used in "cloud" clients like rclone.
Enabling 2FA modifies the OAuth handshake performed by Mailru auth servers introducing a 2nd stage, which is currently not supported by rclone. This is unrelated to the "mail app code" depicted above and can be supported in future but needs modifications on rclone side. This ticket will stay open to track the progress, any help is appreciated. A future support for 2FA in rclone will involve some kind of gui/console interface for user to enter SMS codes on a hourly basis (which essentially deteriorates batch modes of operation, btw). Currently it is recommended to disable 2FA on Mailru accounts intended for rclone until it gets eventually implemented.
Additionally, the mailru developer portal (https://api.mail.ru/docs/guides/social-apps) mentions so-called "social apps" which can be registered (https://api.mail.ru/apps/my/add) by an end user after signing the Mailru developer agreement. The "social apps" are explicitly described in Mailru documentation as javascript-based web applications running in a frame inside Mailru social site "MoiMeer". An experiment has shown that Mailru performs OAUTH token handshake for such apps in a non-standard manner ignoring external URL but redirecting the code-bearing reply to a Mailru subdomain, which should probably be intercepted by javascript from a frame. Adapting a CLI application like rclone to such a pipeline would require invoking the web browser gui with html/js/frame hacks on every token refresh. As this doesn't provide any visible advantage I doubt rclone needs to go for such hacks.
For the sake of completeness one should mention the proprietary Disk-O: client which supports both user/password and some undocumented authorization methods.
It works for me without paid account. I initially got the same "403 Forbidden" error, but after I accessed the mail.ru Cloud on browser (and accepted User Agreement, etc.), it works now through Rclone.
After append this lines in config, i run rclone config and change pass, because not encrypted password is not accepted.
You can also check with standard windows tools
net use O: https://webdav.cloud.mail.ru/ <application password> /user:*******@mail.ru /persistent:no
Activity
Heniker commentedon Oct 18, 2019
I am not sure if that is what you're looking for, tho I think this are the links for authorizing apps on mail.ru:
https://api.mail.ru/docs/guides/social-apps/
https://api.mail.ru/apps/my/add
By the password for apps I actually meant this pass, that appears after you connect your 2FA app to mail.ru:

It appears to be randomly generated 16 digit pass,
btw, thank you for your great work on integrating mail.ru in Rclone.
ivandeex commentedon Oct 18, 2019
Does the app password work with rclone if 2FA is disabled?
Heniker commentedon Oct 19, 2019
You can't generate new app-passwords or access old once you disable 2FA. I guess they just get deleted and can no longer be used.
ivandeex commentedon Oct 22, 2019
I tried to create a test "social" app using your links (http://my.mail.ru/apps/766346) and perform app authorization. Their authorization method requires a browser-based application that is able to capture page loads in subframe. The first redirect during authorization goes to url under mailru refusing to redirect to rclone's localhost url for rclone to capture authorization code. Looks like their "social" app type is not intended for computer based applications, so the problem is not about 2FA (SMS backed user login) alone. This needs further investigation.
ivandeex commentedon Oct 25, 2019
Let's summarize current findings on 2FA and 3rd party apps support in mailru. This can be later added in the backend docs.
A single account is used for the webmail and storage (aka "cloud") services. Only e-mail accounts belonging to Mailru company domains (
@mail.ru,@list.ru,@bk.ru, etc) are fully supported. Their online help states that one can use an external (@yandex.ruetc) email but needs to register it with the Mailru mail in advance. In practice this is not generally recommended as it may involve additional OAUTH redirects, not yet tested in rclone. Account registration process is described in the online help (https://help.mail.ru/engmail-help/registration/signup).Mailru supports 2FA for user accounts. It can be enabled/disabled on the account security settings screen (https://e.mail.ru/settings/security) which is shared between webmail and "cloud", ie. 2FA is enabled or disabled for both simultaneously.

Entering your cell number and confirming one-time SMS code activates 2FA on your account for webmail and disk together, and additionally enables another 2FA configuration screen (https://e.mail.ru/settings/2-step-auth) which allows to:
The code is bound to active 2FA and intended for consumption only by mobile mail applications like TheBat or alike to obtain a token, but cannot be used in "cloud" clients like rclone.
Enabling 2FA modifies the OAuth handshake performed by Mailru auth servers introducing a 2nd stage, which is currently not supported by rclone. This is unrelated to the "mail app code" depicted above and can be supported in future but needs modifications on rclone side. This ticket will stay open to track the progress, any help is appreciated. A future support for 2FA in rclone will involve some kind of gui/console interface for user to enter SMS codes on a hourly basis (which essentially deteriorates batch modes of operation, btw). Currently it is recommended to disable 2FA on Mailru accounts intended for rclone until it gets eventually implemented.

Additionally, the mailru developer portal (https://api.mail.ru/docs/guides/social-apps) mentions so-called "social apps" which can be registered (https://api.mail.ru/apps/my/add) by an end user after signing the Mailru developer agreement. The "social apps" are explicitly described in Mailru documentation as javascript-based web applications running in a frame inside Mailru social site "MoiMeer". An experiment has shown that Mailru performs OAUTH token handshake for such apps in a non-standard manner ignoring external URL but redirecting the code-bearing reply to a Mailru subdomain, which should probably be intercepted by javascript from a frame. Adapting a CLI application like rclone to such a pipeline would require invoking the web browser gui with html/js/frame hacks on every token refresh. As this doesn't provide any visible advantage I doubt rclone needs to go for such hacks.
For the sake of completeness one should mention the proprietary Disk-O: client which supports both user/password and some undocumented authorization methods.
ivandeex commentedon May 18, 2020
Related projects:
sbvitok commentedon May 21, 2020
[mailru]
type = webdav
url = https://webdav.cloud.mail.ru
vendor = other
user = ***@mail.ru
pass = from 3rd party mail application
Works for me.
QuAzI commentedon Aug 29, 2021
Doesn't work with rclone and TotalCommander webdav plugin
Any other workarounds?
upd: only works if you have paid account
rocwhite168 commentedon Jun 15, 2022
It works for me without paid account. I initially got the same "403 Forbidden" error, but after I accessed the mail.ru Cloud on browser (and accepted User Agreement, etc.), it works now through Rclone.
Shkarlatov commentedon Jun 29, 2022
After append this lines in config, i run
rclone configand change pass, because not encrypted password is not accepted.You can also check with standard windows tools