Class OAuth

  • All Implemented Interfaces:
    AutoCloseable

    public class OAuth
    extends Object
    implements AutoCloseable
    OAuth 2.0 client handle for Longbridge OpenAPI

    Instances are created by OAuthBuilder.build(java.util.function.Consumer<java.lang.String>). This class is an opaque handle to the native OAuth object. Call close() (or use try-with-resources) to release native memory when no longer needed.

    
     OAuthBuilder builder = new OAuthBuilder("your-client-id");
     builder.setCallbackPort(8080);  // optional
     OAuth oauth = builder.build(url -> System.out.println("Open: " + url)).get();
     try {
         Config config = Config.fromOAuth(oauth);
     } finally {
         oauth.close();
     }