STXLoginService
Args
email, password | Credentials |
checkTermsAndConditions | If true, the SDK checks whether new T&Cs need acceptance and sets PromptTncAcceptance on the result |
keepSessionAlive | If true, starts STXSessionBackgroundService which refreshes the token + periodically re-logins before the refresh window expires. Requires the SDK to be registered under a hosted IHost so background services run. |
deviceId | Client-provided device identifier |
STXUserDataCollection
Fields returned from login (and Confirm2FAAsync):
Token | JWT bearer for GraphQL |
RefreshToken | Used by RefreshTokenAsync |
UserId, UserUid | User identifiers (UserId is used for channel topics) |
SessionId | Needed for Confirm2FAAsync when 2FA is enabled |
CurrentLoginAt | Login timestamp |
PromptTncAcceptance | true if T&Cs need acceptance |
PromptTwoFactor | true if 2FA completion is pending |
Exceptions
STXWrongCredentialsException | Bad email/password |
STXGeoComplyException | Geo check failed |
STXTokenService
STXLoginService.LoginAsync delegates to STXTokenService.LoginAsync under the hood — use the token service directly when you need to break apart the login + 2FA + T&C steps (e.g. a multi-step UI).
Exceptions from RefreshTokenAsync
STXSessionExpiredException— token AND refresh token both expired. Full re-login required.
STXSessionBackgroundService
Registered as a hosted background service. Kicks on when LoginAsync(keepSessionAlive: true) fires. Responsibilities:
- Every ~15 min, check whether the JWT is within the expiry window; if yes, call
RefreshTokenAsync. - If the refresh token itself is close to expiry, re-login using the password cached in
STXUserStorage.
keepSessionAlive.
Task-oriented examples: Authentication.
