authenticate method
Implementation
Future<bool> authenticate(bool handleSessionAutomatically) async {
_countryCode = '';
_tokenType = '';
_authHeaders.clear();
_userPuuid = '';
_validityTimer?.cancel();
if (await _fetchClientCountry() && await _fetchAccessToken() && await _fetchEntitlements() && await _fetchClientVersion() && await _fetchUserInfo()) {
_authHeaders[ClientConstants.clientPlatformHeaderKey] = ClientConstants.clientPlatformHeaderValue;
_client.options.headers.addAll(_authHeaders);
if (handleSessionAutomatically) {
_validityTimer = Timer(Duration(hours: _accessTokenExpiryInHours), () async => authenticate(handleSessionAutomatically));
}
return true;
}
return false;
}