Class RequestTokenGrantReceiver

java.lang.Object
com.amilesend.tmdb.client.connection.auth.RequestTokenGrantReceiver
All Implemented Interfaces:
AutoCloseable

public class RequestTokenGrantReceiver extends Object implements AutoCloseable
  • Method Details

    • close

      public void close() throws SessionException
      Closes the HTTP server resource.
      Specified by:
      close in interface AutoCloseable
      Throws:
      SessionException - if an error occurred while closing the HTTP server resource
    • browse

      public static void browse(String url)
      Open a browser at the given URL using Desktop if available, or alternatively output the URL to System.out for command-line applications.
      Parameters:
      url - URL to browse
    • start

      public <T> T start() throws SessionException
      Starts the HTTP server to handle OAuth callbacks.
      Returns:
      this OAuthReceiver instance
      Throws:
      SessionException - if an error occurred while starting the HTTP server
    • stop

      public void stop() throws SessionException
      Stops the running HTTP server.
      Throws:
      SessionException - if an error occurred while stopping the server
    • waitForApprovalStatus

      public boolean waitForApprovalStatus() throws SessionException
      Blocks until the server receives a request token grant approval, or when the server is stopped by stop().
      Returns:
      authorization code if login succeeds; may return null if the server is stopped by close()
      Throws:
      SessionException - if an error occurred
    • builder