任何人都可以帮助我为下面的标头和正文写扑打请求,并在下面提供相应的响应;
示例发帖请求
Content-Type:application/x-www-form-urlencoded
grant_type: client_credentials
scope: accounts
client_assertion_type: code**
client_assertion: code**
答案 0 :(得分:1)
尝试以下操作,
String hostname = "myhostname";// example
String port = "1234"; //example
String url = "https://$hostname:$port/as/token.oauth2";
String body = "{'grant_type' : '$client_credentials' }" +
"'scope' : '$accounts'" +
//... etc etc
"'Corresponding Response': { 'access_token': 'JWt CODE', 'expires_in': '86400', 'token_type': 'bearer', 'scope': 'payments' }"+
"}";
var res = await http.post(Uri.encodeFull(url),
headers: {
"Accept": "application/json",
"Content-Type" : "application/x-www-form-urlencoded"
},
body: body);