LoginClient constructor
LoginClient({
- required OAuthSettings oAuthSettings,
- required CredentialsStorage credentialsStorage,
- Client? httpClient,
- _LoggerCallback logger = _defaultPrintLogger,
Creates an http.Client
that is compliant with OAuth2.
The oAuthSettings
stores authorization related settings, like
the client's identifier and secret or the authorization's endpoint.
The credentialsStorage
handles saving and retrieving the authorization
credentials.
The httpClient
is an http.Client
that's used as a parent for the
authorized HTTP client. It is also used for sending unauthorized requests.
Defaults to http.Client
.
The logger
is a simple callback used for logging debug information
that may be helpful. Defaults to printing with a [LoginClient]
prefix.
Make sure to call initialize after instantiating the LoginClient
to correctly restore saved credentials from the credentialsStorage
.
See also:
Implementation
LoginClient({
required OAuthSettings oAuthSettings,
required CredentialsStorage credentialsStorage,
http.Client? httpClient,
_LoggerCallback logger = _defaultPrintLogger,
}) : _oAuthSettings = oAuthSettings,
_httpClient = httpClient ?? http.Client(),
_credentialsStorage = credentialsStorage,
_logger = logger;