Contents
Class OAuthClient
java.lang.Object
com.hypixel.hytale.server.core.auth.oauth.OAuthClient
OAuth2 client for server authentication.
Supports both browser-based PKCE flow and device authorization flow.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordToken response from OAuth2 server. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionrefreshTokens(String refreshToken) Refreshes OAuth tokens using the given refresh token.startFlow(OAuthBrowserFlow flow) startFlow(OAuthDeviceFlow flow) Starts the OAuth2 device authorization flow.
-
Constructor Details
-
OAuthClient
public OAuthClient()
-
-
Method Details
-
startFlow
-
startFlow
Starts the OAuth2 device authorization flow. For headless/remote servers where browser access isn't available.- Parameters:
flow- An OAuthDeviceFlow- Returns:
- A Runnable to cancel the flow
-
refreshTokens
@Nullable public OAuthClient.TokenResponse refreshTokens(@Nonnull String refreshToken) throws IOException, InterruptedException Refreshes OAuth tokens using the given refresh token.- Parameters:
refreshToken- The refresh token- Returns:
- The token response, or null if the server rejected the request (non-retryable)
- Throws:
IOException- If a transient IO error occurred (retryable)InterruptedException- If the request was interrupted
-