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

await steamClient.Login() Never Returns #2507

Open
wessleym opened this issue Feb 15, 2024 · 3 comments
Open

await steamClient.Login() Never Returns #2507

wessleym opened this issue Feb 15, 2024 · 3 comments

Comments

@wessleym
Copy link

wessleym commented Feb 15, 2024

I have written a small C# .NET 8 console application. When I call await steamClient.Login(), my IUserInterventionHandler does get called via Raise(IUserIntervention intervention). From here, I call GetAuthCode.Finish(string code). Everything seems fine. But the steamClient.Login() call never returns. It waits indefinitely.

Additional Context
Windows 11
.NET 8

Wabbajack Version
Wabbajack.Networking.Steam 3.5.0.2
Wabbajack.Services.OSIntegrated 3.0.6.2

Code
Here is the code that causes the problem. See my await steamClient.Login() call. (Please note that I set up the dependencies to reflect what I observed in the Downloader project at https://github.com/wabbajack-tools/ussedp/. If there is a more concise way to accomplish what I've set up with dependencies, I would like to know it. By the way, all I'm really trying to accomplish is downloading a full copy of Skyrim from Steam.)

Here is my program:

LoggerFactory loggerFactory = new LoggerFactory();
Logger<SteamTokenProvider> tokenProviderLogger = new Logger<SteamTokenProvider>(loggerFactory);
var services = new ServiceCollection();
services.AddDTOSerializer();
services.AddDTOConverters();
services.AddSteam();
services.AddSingleton<ILogger<Client>>(new Logger<Client>(loggerFactory));
services.AddSingleton<HttpClient>();
services.AddAllSingleton<ITokenProvider<SteamLoginState>, EncryptedJsonTokenProvider<SteamLoginState>, SteamTokenProvider>();
services.AddSingleton<IUserInterventionHandler>(new UserInterventionHandler());
services.AddSingleton<IResource<HttpClient>>(x => new Resource<HttpClient>("Web Requests", 16));
services.AddSingleton<ILogger<SteamTokenProvider>>(tokenProviderLogger);
ServiceProvider serviceProvider = services.BuildServiceProvider();
DTOSerializer dtoSerializer = serviceProvider.GetRequiredService<DTOSerializer>();
SteamTokenProvider tokenProvider = new SteamTokenProvider(tokenProviderLogger, dtoSerializer);
Client steamClient = serviceProvider.GetRequiredService<Client>();
string userName, password;
SteamUtility.PromptForCredentials(out userName, out password);
await tokenProvider.SetToken(new SteamLoginState
{
    User = userName,
    Password = password
}).ConfigureAwait(false);
try
{
    await steamClient.Login().ConfigureAwait(false);//This waits indefinitely.
}
catch (SteamException)
{
    Console.WriteLine("Your credentials were incorrect.");
}

Here is my IUserInterventionHandler:

internal class UserInterventionHandler : IUserInterventionHandler
{
    public UserInterventionHandler() { }

    public void Raise(IUserIntervention intervention)
    {
        GetAuthCode getAuthCode = (GetAuthCode)intervention;
        Console.WriteLine("Please enter the Steam Guard code that has been emailed to you.");
        string code = "";
        while (code == "")
        {
            code = Console.ReadLine()!.Trim();
        }
        getAuthCode.Finish(code);
    }
}
Copy link

Marked as stale due to no interactions in the last 90 days. If the issue still exists, please provide any possibly still needed information or excuse the devs for not getting around to addressing this issue yet. If this issue is still considered unsolved a dev will soon remove the stale tag from this issue.

@github-actions github-actions bot added the Stale label May 24, 2024
@EzioTheDeadPoet
Copy link
Contributor

Sorry for the late response but the steam login is currently not in use and hasn't been needed by the app in a while and hasn't been updated as well.

@wessleym
Copy link
Author

I see. It would be nice if it could work, but for now, we are having to go a different route. Thank you.

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

2 participants