I was trying to test a logout/login flow and tried to login with my test account and got an error telling me to login with my username which is not possible in the apps. I am not really sure what to do about this issue, so I thought an issue is as good as any other way to get it looked into. /cc @aerych

That's really interesting. 🤔
That error message is something returned from the server. I can take a look and see what scenarios we return it and that might give a clue.
Had you logged in / out other times in the same session?
Had you tried other login methods previously, e.g. Google or magic link?
Yes, I did login with my primary account in both of my tests (both device and emulator). And, yes I did try magic login, and I should have mentioned that in the bug report, and it said Unavailable at this time or something along those lines. I tried the magic login after I got the error.
Since this is a test account and I do a bunch of random stuff, I thought there is chance that I got flagged or something.
Did some checking. This is an error returned when the server detects a "suspicious email" login attempt.
It should be pretty rare that it happens. We should probably be checking for email_login_not_allowed as the error code and the switch to the self-hosted username/password flow with "wordpress.com" pre-filled for the site, or something along those lines.
Related issue for iOS
https://github.com/wordpress-mobile/WordPress-iOS/issues/9618
This is an error returned when the server detects a "suspicious email" login attempt.
I knew I was suspicious :trollface:
Since this is a test account and I do a bunch of random stuff, I thought there is chance that I got flagged or something.
So suspicious 😆
I jumped into my wpcom sandbox and hardwired it to always return the error. Thing is, I see that the error code returned is invalid_request, even though the original code site does throw it as email_login_not_allowed 😬
Maybe someone rethrows the error somewhere along the code path. @aerych perhaps you have some idea there?
This still keeps happening to me. I needed to use my test account for a test and I can't login using my email and there is no option to use the username. It's extremely frustrating for me, I can't imagine it how a user in this situation would feel.
After trying different approaches, I was finally able to find a work around for it which is to follow the self-hosted site flow. I entered my site address and was able to login with username and login. If we there is a specific error type for this, can we point the user to the self-hosted site flow?
A one star review:
Get message: "Please login using your username instead". Well how am I supposed to do that? There's no option to!
Well - they ^ are not wrong 🤷♂️
Likely fixed for iOS with https://github.com/wordpress-mobile/WordPressAuthenticator-iOS/pull/42
Just an FYI that I'm currently experiencing this issue and this flow is being covered via the UI tests and so far a few of them rely on this flow to continue with certain operations and it's also being used in the screenshot generation code. I'm thinking to make the site address flow the default login flow for any automation that doesn't need to go through email/password in the interim until there's a fix for this on Android.
Raising in priority because it's blocking UI tests.
@JavonDavis , does this issue happen consistently on the UI tests you mention? If yes, can you share the credentials the tests are using so I can replicate too? Thanks!
I tried the same approach as I did in the past and seeing the same results. I can setup things in my sandbox to receive the error message in WPAndroid ("Please log in using your WordPress.com username...") but, the error type is too generic (invalid_request) which means I'd need to do a string comparison with the error description to identify it. That'd be a fragile solution, and perhaps not even work on non-english locales.
I'm wondering if the iOS side fix PR does work and still investigating how to properly detect the error.
FYI: For the UI tests on Android in the interim, we've defaulted to the site address login flow.
We are working together with @Tug to land a fix for the backend that will properly bubble the email_login_not_allowed error which currently isn't. Will produce proper support for it in WPAndroid in parallel.
Most helpful comment
We are working together with @Tug to land a fix for the backend that will properly bubble the
email_login_not_allowederror which currently isn't. Will produce proper support for it in WPAndroid in parallel.