Add Support for 2FA
Opened this issue ยท 9 comments
I would like to suggest that support for 2FA be added to the roadmap.
That way the account can keep that layer of security while using this tool.
Thank you
Would you like to send a pull request for this?
I'm just an rclone user and never touched golang but happy to help find a way to approach. You seem to already have this feature in your sites according to this line: https://github.com/t3rm1n4l/go-mega/blob/master/messages.go#L21
I'm not sure what api you are using as I can't find any documentation for a mega rest api. The C++ SDK includes a multiFactorAuthLogin function.
MegaCMD has an undocumented auth-code flag.
If the Mega rest API doesn't support mfa (2fa) then you will have to fundamentally change how this library communicates with MEGA to achieve this feature.
Any progress on this feature request?
#34 seems like a pretty solid fix for this, though I'm not sure the extra 'MultiFactorLogin' is required when regular login supports it as well (and I'm not really a Go person so I'm not sure if the semantics are right for this to be non-breaking)
#34 seems like a pretty solid fix for this, though I'm not sure the extra 'MultiFactorLogin' is required when regular login supports it as well (and I'm not really a Go person so I'm not sure if the semantics are right for this to be non-breaking)
Thank you for the "a pretty solid fix", I really appreciate it.
About the extra function, it is defined as a function separated by the "classic" login method to follow the Mega SDK structure. In this way, a user can be easily traced back to the MegaApi
documentation.
I find it a better solution rather than keeping all in a single login function with arguments that a user could not be using and therefore it would be obliged to pass an OTP code parameter which is empty. So basically I find it cleaner.
A note apart from the rest: sadly I think that this library is dead, I haven't seen active maintainers for a while and pull requests are left unreviewed.
Ah, OK, that makes sense - I'd probably leave the main ๐ edit: wait, i'm dumb, login()
method/func alone, then, and just add the extra one; from my understanding of how Go works, wouldn't changing the args of login()
break all existing calls to the function? Probably better to have that discussion on the PRlogin()
is internal only so it's fine and that's exactly the right way to do it
I agree that this repo seems to be abandoned, or at least very very inactive, which is inconvenient. rclone uses this library to talk to Mega, so rclone can't handle Mega MFA, which is how I ended up here - hoping the library had support and rclone just needed to implement it...
It would be relatively simple to fork the repo and add support - I might do that (and fork rclone) just for my own personal use - but I'm not super comfortable volunteering to maintain the fork long-term when I've never really used Go before, and I'm not sure how willing to change forks the rclone devs would be, anyway ๐