'How can i pass username and password int http req
Recently I have to make login to ubnt(UNifi) devices from flutter application
so I must pass user and password into URL
this is my code :
const url = 'http://10.66.5.8/login.cgi?uri=/';
var res = await http.post(Uri.parse(url), body: {
'username': 'ubnt',
'password': 's11n',
});
if (res.statusCode == 200) {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
} else {
print(res.statusCode);
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text('Error')));
}
I try with API HTTP but no result
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
