trydis / FIFA-Ultimate-Team-Toolkit

FIFA Ultimate Team Toolkit
MIT License
234 stars 110 forks source link

WinForms login #380

Closed weedali closed 6 years ago

weedali commented 6 years ago

Hello everybody

Can anybody help me? I have a problem with login. It's not a problem with the login itself but with the cookie (and login?). The way I login is following: I run this code first: provider = new FutAuth(secKey); <- the secKey is empty the first time loginDetails = new LoginDetails(username, password, secAnswer, Platform.Ps4, AppVersion.WebApp); await client.LoginAsync(loginDetails, provider);

At the first attempt to login I get an exception that the secKey must be 6 digits (blabla, I didn't provide any). At this time I get an email with my secKey. Then I run the code again (this time with secKey) and I'm logged in and can do whatever I want. I assume that this is a very ugly way to login.

Do you have any suggestion how I can improve this?

The problem with the cookie is that I think because of how I login the cookiecontainer gets corrupted or something.

weedali commented 6 years ago

Forget it, there is no other way and my cookies still don't work.

CoverJ commented 6 years ago

hey, we'd need to see your provider code I think. That seems to be where the issue is.

weedali commented 6 years ago

My code is following:

public class FutAuth : ITwoFactorCodeProvider
{
    public TaskCompletionSource<string> taskResult = new TaskCompletionSource<string>();
    private string twoFactorCode;

    public FutAuth()
    {
    }

    public FutAuth(string twoFactorCodeP)
    {
        twoFactorCode = twoFactorCodeP;
    }

    public Task<string> GetTwoFactorCodeAsync(AuthenticationType authType)
    {
        if (!String.IsNullOrEmpty(twoFactorCode))
        {
            taskResult.SetResult(twoFactorCode);
            return taskResult.Task;
        }

        return null;
    }
}

As LoginAsync requires twoFactorCodeProvider I need to check whether the code is empty or not, but ea still sends me the code and the second time I call LoginAsync (this time with the seckey) I'm logged in. I think that LoginAsync doesn't have to have twoFactorCodeProvider as parameter and could rewrite the code but was lazy to do it.

Before you answer, don't forget that I'm using winforms where I don't have something like Console.WriteLine($"{ DateTime.Now } Enter OTP ({ authType }):"); taskResult.SetResult(Console.ReadLine()); Basically I simulate Console.WriteLine($"{ DateTime.Now } Enter OTP ({ authType }):"); with my exception (the first time I try to login).