NhostAuthClient constructor

NhostAuthClient({
  1. required String url,
  2. UserSession? session,
  3. AuthStore? authStore,
  4. Duration? tokenRefreshInterval,
  5. Client? httpClient,
})

authStore (optional) is used to persist authentication tokens between restarts of your app. If not provided, the tokens will not be persisted.

tokenRefreshInterval (optional) is the amount of time the client will wait between refreshing its authentication tokens. If not provided, will default to a value provided by the server.

httpClientOverride (optional) can be provided in order to customize the requests made by the Nhost APIs, which can be useful for proxy configuration and debugging.

Implementation

NhostAuthClient({
  required String url,
  UserSession? session,
  AuthStore? authStore,
  Duration? tokenRefreshInterval,
  http.Client? httpClient,
})  : _apiClient = ApiClient(
        Uri.parse(url),
        httpClient: httpClient ?? http.Client(),
      ),
      _session = session ?? UserSession(),
      _authStore = authStore ?? InMemoryAuthStore(),
      _tokenRefreshInterval = tokenRefreshInterval,
      _refreshTokenLock = false,
      _loading = false;