Class WaybackAuthLib

java.lang.Object
de.florianreuth.waybackauthlib.WaybackAuthLib

public class WaybackAuthLib extends Object
  • Field Details

  • Constructor Details

    • WaybackAuthLib

      public WaybackAuthLib()
      Creates a new instance of the authentication service.
    • WaybackAuthLib

      public WaybackAuthLib(String authHost)
      Creates a new instance of the authentication service.
      Parameters:
      authHost - The host of the authentication service. (e.g. Mojang AuthServer)
    • WaybackAuthLib

      public WaybackAuthLib(String authHost, String clientToken)
      Creates a new instance of the authentication service.
      Parameters:
      authHost - The host of the authentication service. (e.g. Mojang AuthServer)
      clientToken - The client token. (e.g. "")
    • WaybackAuthLib

      public WaybackAuthLib(String authHost, String clientToken, Proxy proxy)
      Creates a new instance of the authentication service.
      Parameters:
      authHost - The host of the authentication service. (e.g. Mojang AuthServer)
      clientToken - The client token. (e.g. "")
      proxy - The proxy to use for the requests.
  • Method Details

    • logIn

      public void logIn() throws Exception
      Logs in the user with the provided credentials. If the user is already logged in, it will refresh the access token.
      Throws:
      InvalidCredentialsException - If the provided credentials are invalid.
      Exception - If the server didn't send a response or the client token doesn't match.
    • checkTokenValidity

      public boolean checkTokenValidity()
    • logOut

      public void logOut() throws Exception
      Logs out the user and invalidates the access token. If the user is not logged in, it will do nothing.
      Throws:
      Exception - If the server didn't send a response or the client token doesn't match.
    • getUsername

      public String getUsername()
    • setUsername

      public void setUsername(String username)
      Sets the username. If the user is logged in, it will throw an exception.
      Parameters:
      username - The username.
    • getPassword

      public String getPassword()
    • setPassword

      public void setPassword(String password)
      Sets the password. If the user is logged in, it will throw an exception.
      Parameters:
      password - The password.
    • getAccessToken

      public String getAccessToken()
    • setAccessToken

      public void setAccessToken(String accessToken)
      Sets the access token. If the user is logged in, it will throw an exception.
      Parameters:
      accessToken - The access token.
    • getUserId

      public String getUserId()
    • isLoggedIn

      public boolean isLoggedIn()
    • getCurrentProfile

      public com.mojang.authlib.GameProfile getCurrentProfile()
    • getProperties

      public List<com.mojang.authlib.properties.Property> getProperties()
    • getProfiles

      public List<com.mojang.authlib.GameProfile> getProfiles()
    • toString

      public String toString()
      Overrides:
      toString in class Object