-
Notifications
You must be signed in to change notification settings - Fork 496
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
Add SteamAuthentication to handle new Steam login flow sessions #1129
Conversation
SteamKit2/SteamKit2/Steam/Handlers/SteamAuthentication/SteamAuthentication.cs
Outdated
Show resolved
Hide resolved
`StartPolling()` can throw `AuthenticationException ` e.g. in rate limited case, if we want to allow callers to handle this (e.g. by adding delay before next try), we must make it public.
SteamKit2/SteamKit2/Steam/Handlers/SteamAuthentication/SteamAuthentication.cs
Outdated
Show resolved
Hide resolved
Logging in as SteamClient requires to do it over CM. I tried over webapi, but it throws InvalidParam, and using other types will give InvalidPassword when trying to logon. This means that CM will kick you in 60 seconds if you don't auth. Steam client also has this issue, but it will reconnect and just continue polling. I don't want to deal with graceful reconnections in the scope of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this implementation in ASF, works good enough in my opinion to be released as part of SK2 alpha release: JustArchiNET/ArchiSteamFarm#2843
Current code should good enough to release an alpha version and get this tested by consumers. We can improve the implementation and specifics in the future. |
When alpha version will be available to download? |
// This is simply showing how to parse JWT, this is not required to login to Steam | ||
void ParseJsonWebToken( string token, string name ) | ||
{ | ||
// You can use a JWT library to do the parsing for you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be tempted to pull in System.IdentityModel.Tokens.Jwt instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it for a minute, and getting info out of it is more effort than I'm willing to spend.
SteamKit2/SteamKit2/Steam/Handlers/SteamAuthentication/AuthenticationException.cs
Outdated
Show resolved
Hide resolved
SteamKit2/SteamKit2/Steam/Handlers/SteamAuthentication/AuthenticationException.cs
Outdated
Show resolved
Hide resolved
SteamKit2/SteamKit2/Steam/Handlers/SteamAuthentication/SteamAuthentication.cs
Outdated
Show resolved
Hide resolved
SteamKit2/SteamKit2/Steam/Handlers/SteamAuthentication/SteamAuthentication.cs
Outdated
Show resolved
Hide resolved
SteamKit2/SteamKit2/Steam/Handlers/SteamAuthentication/SteamAuthentication.cs
Outdated
Show resolved
Hide resolved
SteamKit2/SteamKit2/Steam/Handlers/SteamAuthentication/UserConsoleAuthenticator.cs
Outdated
Show resolved
Hide resolved
SteamKit2/SteamKit2/Steam/Handlers/SteamAuthentication/UserConsoleAuthenticator.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are also still obsoletion warnings in the build that need to be taken care of (probably just suppressed).
Fixes #1125.
This is a work in progress. When beginning an auth session it returns a new object which some methods to do stuff on the session.
It adds a new IAuthenticator class to provide 2FA codes (with an example implementation that just reads from the console).
What I am not entirely certain about is the polling design (right now it's just a loop with task.delay).