loginWithCode method

  1. @override
Future<AuthTokens> loginWithCode(
  1. String code, {
  2. required String deviceId,
})
override

Login with feedback code and return tokens

code - The feedback code from device feedback API deviceId - The device ID used for the feedback API call

Implementation

@override
Future<AuthTokens> loginWithCode(
  String code, {
  required String deviceId,
}) async {
  final response = await remoteDataSource.loginWithCode(code);

  if (response.data == null) {
    throw Exception('Login failed: No data received');
  }

  final tokens = response.toAuthTokens(deviceId: deviceId);
  if (tokens == null) {
    throw Exception('Login failed: Invalid token data');
  }

  return tokens;
}