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

Add SteamAuthentication to handle new Steam login flow sessions #1129

Merged
merged 29 commits into from
Mar 23, 2023
Merged

Add SteamAuthentication to handle new Steam login flow sessions #1129

merged 29 commits into from
Mar 23, 2023

Conversation

xPaw
Copy link
Member

@xPaw xPaw commented Aug 31, 2022

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).

JustArchi and others added 4 commits March 15, 2023 17:49
`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.
@xPaw xPaw marked this pull request as ready for review March 17, 2023 12:24
@xPaw
Copy link
Member Author

xPaw commented Mar 17, 2023

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.

Copy link
Contributor

@JustArchi JustArchi left a 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

@xPaw
Copy link
Member Author

xPaw commented Mar 18, 2023

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.

@xPaw xPaw requested a review from yaakov-h March 18, 2023 09:09
@Adios22
Copy link

Adios22 commented Mar 19, 2023

When alpha version will be available to download?

Samples/1a.Authentication/Program.cs Outdated Show resolved Hide resolved
Samples/1a.Authentication/Program.cs Outdated Show resolved Hide resolved
// 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
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

@yaakov-h yaakov-h left a 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).

@xPaw xPaw merged commit 1d50962 into SteamRE:master Mar 23, 2023
@xPaw xPaw deleted the authentication branch March 23, 2023 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Steam login flow
5 participants