Interface AltLoginService
No route throws at the caller or completes its future exceptionally. Every failure, a runtime
closed before the route started included, is a LoginResult whose
LoginResult.failure() says what kind it was (AltsFailure.Kind.CANCELLED
for a closed runtime or a refusing executor).
Not designed for host implementation; methods may be added in minor releases.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionloginAccount(AltAccount account) Performs a login operation using an existingAltAccountdata model.loginCookie(String cookieData, LoginMode mode) Authenticates using raw browser cookie data.loginCookieFile(Path file, LoginMode mode) Authenticates using cookies exported to a file, which is the shape browser extensions produce them in.default CompletableFuture<LoginResult> loginDeviceCode(DeviceCodePrompt prompt, LoginMode mode) Initiates authentication through the OAuth device-authorization grant: the host shows the user a short code and an address throughprompt, the user enters the code in any browser on any device, and the library polls until the sign-in is approved, declined, or expires.loginMicrosoft(LoginMode mode) Initiates authentication through the official Microsoft OAuth2 flow.loginOffline(String username, LoginMode mode) Authenticates for offline (cracked) play using only a username.loginRefreshToken(String refreshToken, LoginMode mode) Authenticates using a stored OAuth refresh token, skipping the interactive browser step.loginSession(String sessionToken, LoginMode mode) Authenticates using a pre-existing Minecraft access token or session string.Returns a view of this login service whose every request carriestagas theroute tagits proxy provider sees, on every hop of every route: the token exchange, Xbox Live, XSTS, the Minecraft services login, the profile lookup, the cookie chain, and the renewal behindloginAccount(AltAccount).
-
Method Details
-
loginMicrosoft
Initiates authentication through the official Microsoft OAuth2 flow.- Parameters:
mode- the login mode (whether to add the account to storage)- Returns:
- a future containing the result of the login attempt
- Since:
- 0.1.0
-
loginDeviceCode
Initiates authentication through the OAuth device-authorization grant: the host shows the user a short code and an address throughprompt, the user enters the code in any browser on any device, and the library polls until the sign-in is approved, declined, or expires. It needs no loopback port and no local browser, so it is the interactive route for a headless or locked-down machine. The resulting account carries a refresh token exactly asloginMicrosoft(LoginMode)does.The library never opens a browser for this flow and never prints the code. Cancelling the returned future stops the polling.
Phishing. A device code signs in whoever started the flow, not whoever types the code. Call this only on an explicit action by the user, and always display the real verification address the prompt is given.
The default implementation reports
NOT_CONFIGURED: a login service that offers no device-code sign-in says so as a result, like every other failure, rather than by throwing.- Parameters:
prompt- the host seam that shows the user the code and the verification addressmode- the login mode (whether to add the account to storage)- Returns:
- a future containing the result of the login attempt
- Since:
- 0.12.0
-
loginCookie
Authenticates using raw browser cookie data. Reuses an existing browser session: the cookies, exported from a browser already signed in, sign the account in without asking for its password again.- Parameters:
cookieData- the cookie string in Netscape or mangled formatmode- the login mode- Returns:
- a future containing the result of the login attempt
- Since:
- 0.1.0
-
loginCookieFile
Authenticates using cookies exported to a file, which is the shape browser extensions produce them in. The file is read off the calling thread; decoding and parsing are handled for the caller, so a host only has to supply a path.- Parameters:
file- the exported cookie file, in Netscape or mangled formatmode- the login mode- Returns:
- a future containing the result of the login attempt
- Since:
- 0.7.0
-
loginSession
Authenticates using a pre-existing Minecraft access token or session string.- Parameters:
sessionToken- the raw access token or session stringmode- the login mode- Returns:
- a future containing the result of the login attempt
- Since:
- 0.1.0
-
loginRefreshToken
Authenticates using a stored OAuth refresh token, skipping the interactive browser step. The token endpoint issues a rotated refresh token, which is stored on the resulting account.- Parameters:
refreshToken- the OAuth refresh token to redeemmode- the login mode- Returns:
- a future containing the result of the login attempt
- Since:
- 0.6.0
-
loginOffline
Authenticates for offline (cracked) play using only a username.- Parameters:
username- the desired offline usernamemode- the login mode- Returns:
- a future containing the result of the login attempt
- Since:
- 0.1.0
-
loginAccount
Performs a login operation using an existingAltAccountdata model.- Parameters:
account- the account data to authenticate with- Returns:
- a future containing the result of the login attempt
- Since:
- 0.1.0
-
routed
Returns a view of this login service whose every request carriestagas theroute tagits proxy provider sees, on every hop of every route: the token exchange, Xbox Live, XSTS, the Minecraft services login, the profile lookup, the cookie chain, and the renewal behindloginAccount(AltAccount). For a host that pins each account to its own proxy and has to route a new account's first sign-in before any account UUID exists to route on. The view stores, injects and classifies exactly as this service does; only the tag differs.The tag belongs to the sign-in, not to the account it produces. Once the account exists, what is done with it is routed by its UUID like any other:
AltsRuntime#accountServices, a bulk check or refresh, and a laterloginAccountthrough the service itself carry no tag. A host that wants the account kept on the same proxy maps its UUID to that proxy in its provider.- Parameters:
tag- the host's route tag- Returns:
- the tagged view
- Throws:
NullPointerException- iftagis nullIllegalArgumentException- iftagis blank- Since:
- 1.0.0
-