Implement browser sign-in method (#1447)

* Implement browser sign-in method

* Handle empty link

* Improve

* Handle user cancel login
This commit is contained in:
ReinforceZwei 2021-02-06 09:29:14 +08:00 committed by GitHub
parent 424f514be2
commit 71eb1dca17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 124 additions and 8 deletions

View file

@ -21,6 +21,8 @@ namespace MinecraftClient.Protocol
private Regex invalidAccount = new Regex("Sign in to", RegexOptions.IgnoreCase);
private Regex twoFA = new Regex("Help us protect your account", RegexOptions.IgnoreCase);
public string SignInUrl { get { return authorize; } }
/// <summary>
/// Pre-authentication
/// </summary>
@ -114,7 +116,7 @@ namespace MinecraftClient.Protocol
if (twoFA.IsMatch(response.Body))
{
// TODO: Handle 2FA
throw new Exception("2FA enabled but not supported yet. Try to disable it in Microsoft account settings");
throw new Exception("2FA enabled but not supported yet. Use browser sign-in method or try to disable 2FA in Microsoft account settings");
}
else if (invalidAccount.IsMatch(response.Body))
{