I am working with basic authentication in a get request, and it takes parameters, but it throws the following error as a status code and response body.
{"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One or more validation errors occurred.","status":400,"traceId":"00-5bebf6cfcb0e1cec5306c5dbff1cf6c0-c432aba0a422c830-00","errors":{"password":["The password field is required."],"user_name":["The user_name field is required."]}}.
I don't know what it means and what should I fix in my code. Can anybody help me, here is my code:
String basicAuth =
'Basic ${base64.encode(utf8.encode('$_email:$encodedPassword'))}';
var queryParams = {
'domain_name': 'domainName',
'token': 12345.toString(),
};
final uri =
Uri.https(baseUrl, '/api/Employee/validate_user', queryParams);
final res = await http.get(uri, headers: {
HttpHeaders.contentTypeHeader: 'application/json',
HttpHeaders.authorizationHeader: basicAuth,
});
if (res.statusCode == 200) {
debugPrint(res.body);
}else {
debugPrint("Status " + res.statusCode.toString());
debugPrint(res.body);
}