Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login 2FA MakeAuthWithPasswordAsync method missing #50

Open
TonySeedy opened this issue Jul 27, 2021 · 5 comments
Open

Login 2FA MakeAuthWithPasswordAsync method missing #50

TonySeedy opened this issue Jul 27, 2021 · 5 comments

Comments

@TonySeedy
Copy link

Hello everyone
I did not found MakeAuthWithPasswordAsync method
I cant login 2fa without AuthPassword
Did you change it or move it to another class that I can't find?
i tried change like TLSharp version but it doesn't work in TG

@silemftooh
Copy link

i need this method too

@atrdev-rgb
Copy link

@pahager
Copy link

pahager commented Jan 8, 2022

Did you find a solution how to use 2FA Auth?

@atrdev-rgb
Copy link

try
{
await RequestWithDcMigration(request, token).ConfigureAwait(false);
}
catch (CloudPasswordNeededException ex)
{
if (password != "")
{
requestCheckPassword = new TLRequestCheckPassword { Password = await SRPHelper.CheckPassword(this, password, token) };
await RequestWithDcMigration(requestCheckPassword, token).ConfigureAwait(false);
}
else throw ex;
}

        if (requestCheckPassword == null && request.Response is TLAuthorization)
        {
            OnUserAuthenticated(((TLUser)((TLAuthorization)request.Response).User));
            return ((TLUser)((TLAuthorization)request.Response).User);
        }
        else if (requestCheckPassword != null && requestCheckPassword.Response is TLAuthorization)
        {
            OnUserAuthenticated(((TLUser)((TLAuthorization)requestCheckPassword.Response).User));
            return ((TLUser)((TLAuthorization)requestCheckPassword.Response).User);
        }
        else
        {
            var signUpRequest = new TLRequestSignUp() { PhoneNumber = phoneNumber, PhoneCodeHash = phoneCodeHash, FirstName = firstName, LastName = lastName };
            await RequestWithDcMigration(signUpRequest, token).ConfigureAwait(false);
            OnUserAuthenticated((TLUser)signUpRequest.Response.User);
            return (TLUser)signUpRequest.Response.User;
        }

@pahager
Copy link

pahager commented Jan 8, 2022

@atrezonator Thx, for your answer. Do I need to paste this in MakeAuthAsync Method or I need to create new MakeAuthWithPasswordAsync Method and paste this code? Btw. TgSharp does not have SRPHelper Class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants