furaiev / amazon-cognito-identity-dart-2

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
187 stars 114 forks source link

Nullsafety breaks login #127

Closed mat100payette closed 3 years ago

mat100payette commented 3 years ago

Tried upgrading to 1.0.0-nullsafety.0 but the login broke.

Going into authenticateUser, then _authenticateUserDefaultAuth(...), I see that data = await client!.request('InitiateAuth', await _analyticsMetadataParamsDecorator.call(params)); throws with the following:

CognitoClientException: Cognito client request error with unknown message

The same code works using 0.1.25+1.

furaiev commented 3 years ago

Thanks for reporting @mat100payette , 1.0.0-nullsafety.0 wasn't actually tested yet and can contain errors.

If you have some time please investigate and contribute.

zelliot commented 3 years ago

The problem is with the http.post in client.dart. It parses the URL incorrectly. The package needs to use Uri.parse, which doesn't work with String?.

furaiev commented 3 years ago

Hey @zelliot , Thanks, please try 1.0.0-nullsafety.1

zelliot commented 3 years ago

Unfortunately still not working. I left a comment on the commit.

You need to change Line 45 to Uri.parse(endpointReq!),

furaiev commented 3 years ago

@zelliot plz try 1.0.0-nullsafety.2

zelliot commented 3 years ago

Works perfectly now. Thanks @furaiev!

mat100payette commented 3 years ago

I confirm that this has been fixed. Thanks.