Class OAuthClient

java.lang.Object
com.hypixel.hytale.server.core.auth.oauth.OAuthClient

public class OAuthClient extends Object
OAuth2 client for server authentication. Supports both browser-based PKCE flow and device authorization flow.
  • Constructor Details

    • OAuthClient

      public OAuthClient()
  • Method Details

    • startFlow

      public Runnable startFlow(@Nonnull OAuthBrowserFlow flow)
    • startFlow

      public Runnable startFlow(OAuthDeviceFlow flow)
      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