teranetsrl / oauth2_client

Simple Dart library for interacting with OAuth2 servers.
BSD 2-Clause "Simplified" License
91 stars 111 forks source link

Query param error #151

Closed juanagu closed 1 year ago

juanagu commented 1 year ago

Hello, I'm trying to use the next params

const params = {
      'response_type': 'token',
      'display': 'page',
      'extras': {'setup':{'channel':'IG_API_ONBOARDING'}},
    };

The function params2qs should check if the value is String before to do a v.trim()

juanagu commented 1 year ago

Possible solution:

params.forEach((k, v) {
      String val;
      if (v is List) {
        val = Uri.encodeComponent(v.map((p) => p.trim()).join(' '));
      } else if (v is Map) {
        val = jsonEncode(v);
      } else {
        val = v.toString().trim();
      }
      qsList.add(k + '=' + val);
});
okrad commented 1 year ago

@juanagu thank you, you are right, I will add the patch in the next release