emersion / hydroxide

A third-party, open-source ProtonMail CardDAV, IMAP and SMTP bridge
MIT License
1.62k stars 125 forks source link

Not being asked for 2FA code when auth #76

Closed subdee closed 4 years ago

subdee commented 4 years ago

On master branch, when I try to auth hydroxide auth myusername, I get asked for password and then I expect to be asked for 2FA code but instead I get authentication failure. Logs from Protonmail say Login failure (two-factor)

emersion commented 4 years ago

Can you investigate what happens after the Client.AuthInfo call? What are the values returned?

We're probably reading a deprecated field there.

subdee commented 4 years ago

I am not familiar with GOLANG unfortunately, I tried printing the response but I either got some PGP encrypted message or some hex stuff that I couldn't make sense of. Any other way? Maybe if you can guide me on how and where to print things, then I can provide you with the results.

0x00031337 commented 4 years ago

Same here. Without 2FA works ok.

With 2FA:

/go # hydroxide auth [xxxxxxxxxxxxxxxxxx]
Password:
2019/11/18 19:24:13 warning: failed to check SRP modulus signature: openpgp: unsupported feature: public key algorithm 22
2019/11/18 19:24:14 request failed: POST https://mail.protonmail.com/api/auth: [8002] Incorrect login credentials. Please try again
2019/11/18 19:24:14 [8002] Incorrect login credentials. Please try again

Without 2FA:

/go # hydroxide auth [xxxxxxxxxxxxxxxxxx]
Password:
2019/11/18 19:14:39 warning: failed to check SRP modulus signature: openpgp: unsupported feature: public key algorithm 22
2019/11/18 19:14:40 warning: failed to read key "[xxxxxxxxxxxxxxxxxx]": failed to read private key: openpgp: unsupported feature: public key type: 22
Bridge password: [xxxxxxxxxxxxxxxxxx]
subdee commented 4 years ago

@emersion Is there any way you can help us help you to get this fixed when you have time? Thanks!

emersion commented 4 years ago

My guess is that we're using a deprecated field in the AuthInfo struct. There is TwoFactor and TwoFactorInfo.Enabled, TwoFactor probably got dropped.

nstickney commented 4 years ago

@emersion I've removed TwoFactor (and replaced with TwoFactorInfo.Enabled) without success... still get the same message.

What are you using as a reference for the Protonmail API? I've been looking around and can't seem to find much....

emersion commented 4 years ago

I'm using docs someone uploaded as a torrent: https://pastebin.com/LCMFGD1G

These aren't updated anymore unfortunately. Would be nice to have access to official API docs at some point.

I'm also using the web browser's network debugging tools with the web client.