authenticateUser method

Future<User?> authenticateUser(
  1. String apiKey,
  2. String customerId,
  3. String externalUserId,
  4. String companyId,
)

Implementation

Future<User?> authenticateUser(
  String apiKey,
  String customerId,
  String externalUserId,
  String companyId,
) async {
  try {
    final result = await dio.post(
      '${Config.url}/users/auth',
      data: {
        'externalUserId': externalUserId,
        'externalCompanyId': companyId,
      },
      options: Options(
        headers: {
          'Content-Type': 'application/json',
          'Accept': 'application/json',
          "x-api-key": apiKey,
          "x-customer": customerId,
        },
      ),
    );

    return User.fromJson(result.data);
  } catch (e) {
    return null;
  }
}