jonsaw / amazon-cognito-identity-dart

Unofficial Amazon Cognito Identity Provider Dart SDK, to easily add user sign-up and sign-in to your mobile and web apps with AWS.
MIT License
204 stars 93 forks source link

Http Browser Client #20

Closed tskinn closed 4 years ago

tskinn commented 6 years ago

Is it just me or am I kind of stuck using the io http client?

I am trying to utilize this package in an angulardart app but I get this error when instantiating a CognitoUserPool object:

EXCEPTION: Unsupported operation: Platform._version
STACKTRACE: 
dart:sdk_internal                                                          new
package:http/src/io_client.dart 23:56                                      new
package:http/src/client.dart 30:23                                         new
package:amazon_cognito_identity_dart/src/client.dart 24:26                 new
package:amazon_cognito_identity_dart/src/cognito_user_pool.dart 36:14      new
package:angular_app/src/core/cognito/cognito_service.dart 20:14            new

I believe this error is a consequence of using the http client in the browser. The Client class allows for injecting the http.Client into it, but the CognitoUserPool does not have a constructor that allows injection of the Client. It is possible to change the client after instantiation but then I would always get this error. Should I make a pull request with that capability?

jonsaw commented 6 years ago

Hey @tskinn, if you have a PR ready, I'll be glad to take a look!

tskinn commented 4 years ago

Not necessary any more since http package has been updated.