-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Currently there are only two types of connection:
The connection is made in the following way:
import SteamAuth;
To work with Steam Guard and confirm trades, you need to log in for further actions.
For this we use the class UserLogin
new UserLogin(username:string, password:string)
-
username:string
- Credentials for Steam -
password:string
- Credentials for Steam
//Credentials for Steam
string username = “”;
string password = “”;
//Class initialization
UserLogin login = new UserLogin(username, password);
During authorization on Steam, it may require various account confirmations.
NeedCaptcha
This response sends a link to the captcha image. If this
response
is received, then a unique text is received in CaptchaGID.To get a link use:
APIEndpoints.COMMUNITY_BASE + "/public/captcha.php?gid=" + login.CaptchaGID
Then you need to pass the code from the image to
CaptchaText
login.CaptchaText = captchaText;
captchaText
- сode from the picture
//Attempt to login
LoginResult response = login.DoLogin();
if(response == LoginResult.NeedCaptcha)
{
//Open a web browser to the captcha image
System.Diagnostics.Process.Start(APIEndpoints.COMMUNITY_BASE + "/public/captcha.php?gid=" + login.CaptchaGID);
string captchaText = Console.ReadLine();
login.CaptchaText = captchaText;
response = login.DoLogin();
}
Need2FA
This answer means that Steam Guard is enabled on this account and it asks to code.
Then you need to pass the code from Steam Guard to
TwoFactorCode
//Attempt to login
LoginResult response = login.DoLogin();
if(response == LoginResult.Need2FA)
{
string code = Console.ReadLine();
login.TwoFactorCode = code;
response = login.DoLogin();
}
NeedEmail
This response means that a code was sent to the user's mail to verify the account.
Then you need to pass the code from mail to
EmailCode
//Attempt to login
LoginResult response = login.DoLogin();
if(response == LoginResult.NeedEmail)
{
string code = Console.ReadLine();
login.EmailCode = code;
response = login.DoLogin();
}
Function DoLogin()
which is used in the class UserLogin
returns parameter LoginResult
LoginResult response = login.DoLogin();
LoginResult response = LoginResult.BadCredentials;
while ((response = login.DoLogin()) != LoginResult.LoginOkay)
{
switch (response)
{
case LoginResult.NeedEmail:
Console.WriteLine("Please enter your email code: ");
string code = Console.ReadLine();
login.EmailCode = code;
break;
case LoginResult.NeedCaptcha:
System.Diagnostics.Process.Start(APIEndpoints.COMMUNITY_BASE + "/public/captcha.php?gid=" + login.CaptchaGID);
Console.WriteLine("Please enter captcha text: ");
string captchaText = Console.ReadLine();
login.CaptchaText = captchaText;
break;
case LoginResult.Need2FA:
Console.WriteLine("Please enter your mobile authenticator code: ");
code = Console.ReadLine();
login.TwoFactorCode = code;
break;
}
}
After LoginResult
returned LoginOkay
, you can connect Steam Guard to this account with saving the cipher key.
To do this, you need to use the AuthenticatorLinker
class.
When the class is initialized, the login.Session
argument is passed.
AuthenticatorLinker linker = new AuthenticatorLinker(login.Session);
⚠️ Important!⚠️ To enable Steam Guard,user account must have a phone number associated with it. When adding Steam Guard, an SMS code will be sent to the user's phone.Everything is fine, there is a check on the phone.
In AuthenticatorLinker we need 2 functions:
AddAuthenticator
FinalizeAddAuthenticator
Can be executed after AddAuthenticator