Class YoutubeOauth2Handler

java.lang.Object
dev.lavalink.youtube.http.YoutubeOauth2Handler

public class YoutubeOauth2Handler extends Object
  • Field Details

  • Constructor Details

    • YoutubeOauth2Handler

      public YoutubeOauth2Handler(com.sedmelluq.discord.lavaplayer.tools.io.HttpInterfaceManager httpInterfaceManager)
  • Method Details

    • setRefreshToken

      public void setRefreshToken(@Nullable @Nullable String refreshToken, boolean skipInitialization)
    • hasAccessToken

      public boolean hasAccessToken()
    • shouldRefreshAccessToken

      public boolean shouldRefreshAccessToken()
    • getRefreshToken

      @Nullable public @Nullable String getRefreshToken()
    • isOauthFetchContext

      public boolean isOauthFetchContext(org.apache.http.client.protocol.HttpClientContext context)
    • fetchDeviceCode

      public com.sedmelluq.discord.lavaplayer.tools.JsonBrowser fetchDeviceCode()
      Retrieves a device code for use with the OAuth flow. The returned payload will contain a user code and a device code, as well as a recommended poll interval, which must be used to complete the flow.
    • fetchRefreshToken

      public com.sedmelluq.discord.lavaplayer.tools.JsonBrowser fetchRefreshToken(String deviceCode) throws IOException
      Retrieve a refresh token from a given device code. This might not yield a successful response if the OAuth flow for the given device code has not yet been completed, or the device code is invalid.
      Parameters:
      deviceCode - The device code obtained from fetchDeviceCode()
      Throws:
      IOException
    • refreshAccessToken

      public void refreshAccessToken(boolean force)
      Refreshes an access token using a supplied refresh token.
      Parameters:
      force - Whether to forcefully renew the access token, even if it doesn't necessarily need to be refreshed yet.
    • createNewAccessToken

      public com.sedmelluq.discord.lavaplayer.tools.JsonBrowser createNewAccessToken(String refreshToken)
      Executes the HTTP request to refresh the access token and returns the response.
      Parameters:
      refreshToken - The refresh token to be included in the request.
      Returns:
      The JSON response as a JsonObject.
    • applyToken

      public void applyToken(org.apache.http.client.methods.HttpUriRequest request)
    • applyToken

      public void applyToken(org.apache.http.client.methods.HttpUriRequest request, String token)