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

Unable to renew CognitoSession for federated login and s3 upload #92

Closed kishann closed 3 years ago

kishann commented 4 years ago

I have created Cognito's federated sign in for google as mentioned in use case 19. According to which, the session is created as follows:-

final session = new CognitoUserSession(idToken, accessToken, refreshToken: refreshToken);

However, for s3 upload signing, I am unable to renew the session using the following method(for the obvious reason that the authentcation is done using password):-

final authDetails =
      AuthenticationDetails(username: '+60100000000', password: 'p&ssW0RD');

  CognitoUserSession _session;
  try {
    _session = await _cognitoUser.authenticateUser(authDetails);
  } catch (e) {
    print(e);
  }

Is it possible to renew the session with the available idToken, accessToken and refreshToken as in the first case for both the s3 upload signing as well as login renewal?

Thanks in advance.