authorize method

Future<Either<Failure, String>> authorize(
  1. String clientId,
  2. String clientSecret
)

Implementation

Future<Either<Failure, String>> authorize(
    String clientId, String clientSecret) async {
  var body = 'client_id=$clientId&client_secret=$clientSecret';
  final response = await post(
      '${Get.find<AadhaarSdkController>().baseUrl}/authorize', body,
      contentType: 'application/x-www-form-urlencoded');
  if (response.status.hasError) {
    return Left(ServerFailure(
        response.statusText ?? "Error while getting data",
        response.statusCode ?? 404));
  } else {
    if (response.bodyString != null) {
      return Right(response.bodyString!);
    }
    return const Left(ServerFailure("Error while getting data", 404));
  }
}