anyone could help me to write flutter request post for the following header and body with the corresponding response below;
Example Post Request
Content-Type:application/x-www-form-urlencoded
grant_type: client_credentials
scope: accounts
client_assertion_type: code**
client_assertion: code**
Try the following,
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With