401 unauthorized error in flutter on sandbox account

Hello, I registered for a sandbox account, and verify my email, but I am getting a 401 unauthorized error in my application when I use the sandbox credentials. I am using Flutter (dart language). The code is pasted below. Any help would be greatly appreciated!

Future<void> _getAccessToken() async {
    final clientCredentials = base64.encode(utf8.encode('$dwollaApiKey:$dwollaApiSecret'));

    final response = await http.post(
      Uri.parse(dwollaTokenUrl),
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Authorization': 'Basic $clientCredentials',
      },
      body: {
        'grant_type': 'client_credentials',
      },
    );

    if (response.statusCode == 200) {
      final data = json.decode(response.body);
      final token = data['access_token'];

      setState(() {
        accessToken = token;
        error = null;
      });
    } else {
      setState(() {
        error = 'Failed to retrieve access token';
      });
    }
  }

  Future<void> _makeApiRequest() async {
    if (accessToken != null) {
      final response = await http.get(
        Uri.parse('$dwollaApiUrl/transactions'),
      
        headers: {
          'Authorization': 'Bearer $accessToken',
          
        },
      );

      if (response.statusCode == 200) {
        // Handle the successful API response
        print(response.body);
      } else {
        // Handle the error
        print('API request failed with status code: ${response.statusCode}');
      }
    } else {
      setState(() {
        error = 'Access token not available';
      });
    }
  }

Thanks,