|
Longbridge OpenAPI C++ SDK
|
#include <oauth.hpp>
Public Member Functions | |
| OAuthBuilder (const std::string &client_id, uint16_t callback_port=0) | |
| void | build (std::function< void(const std::string &)> open_url, AsyncCallback< void *, OAuth > callback) |
Builder for constructing an OAuth 2.0 client
Tries to load an existing token from ~/.longbridge-openapi/tokens/<client_id>. If the token is missing or expired, starts a local callback server and calls open_url so the caller can open the authorization URL in a browser.
| longbridge::OAuthBuilder::OAuthBuilder | ( | const std::string & | client_id, |
| uint16_t | callback_port = 0 |
||
| ) |
| client_id | OAuth 2.0 client ID from the Longbridge developer portal |
| callback_port | Local callback server port; pass 0 to use the default (60355) |
| void longbridge::OAuthBuilder::build | ( | std::function< void(const std::string &)> | open_url, |
| AsyncCallback< void *, OAuth > | callback | ||
| ) |
Asynchronously build an OAuth 2.0 client
| open_url | Called with the authorization URL during the auth flow |
| callback | Invoked on completion; result data is OAuth* |