- 直接上代码
String username = '***';
String password = '***';
String basicAuth =
'Basic ' + base64Encode(utf8.encode('$username:$password'));
print(basicAuth);
Dio dio = new Dio();
dio.post("***"
"username":"***",
"password":"***",
"grant_type":"password"
},options: new Options(
headers: {"Authorization":basicAuth},
contentType: ContentType.parse("application/x-www-form-urlencoded"),
)).then((response){
print(response.data);
});
- postman
E51CA3CE.png
网友评论