authenticate method
Sign in with username
and password
.
Implementation
Future<void> authenticate({
required String username,
required String password,
}) async {
log('Authenticating with username $username');
emit(AsyncValue.loading());
await guard(
() => _auth.authenticate(
username: username,
password: password,
webservices: Webservice.values.toSet(),
),
onData: (p0) => captureEvent('user_login'),
);
if (!state.hasData) return;
log('Authentication successful');
await _localStorage.write(state.requireData);
}