Skip to content
This repository has been archived by the owner on Feb 24, 2018. It is now read-only.

Use this library without a cognito pool, just a federated identity pool #684

Open
interestinglive opened this issue Feb 12, 2018 · 0 comments

Comments

@interestinglive
Copy link

Hi, we have a federated identity pool, not a user pool and are successfully authenticating and accessing AWS resources which is all good.

We are having the issue that our sessions seem to expire after 15 minutes and we receive the error "Invalid login token. Token expired: 1518436004076 >= 1518435610394" this occurs even though we are calling refresh on our credentials regularly.

I've run out of ideas and am hoping for a bit of help, any ideas what we are doing incorrectly?

Our auth code is as below:

let Logins = {};
Logins[environment.samlIdpArn] = samlResponse;
AWS.config.region = environment.region;
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
  IdentityPoolId: environment.identityPoolId,
  CustomRoleArn: environment.roleSelectedArn,
  Logins
});

let tmp = this;
AWS.config.getCredentials(function (err) {
  if (err) {
    console.log("error getting creds - check session");
    callback.cognitoCallback(err.message, null);

  } else {
    tmp.cognitoUtil.setCognitoCreds(<AWS.CognitoIdentityCredentials>AWS.config.credentials);
    callback.cognitoCallback(null, "Authenticated");
  }
});

And we are refreshing as per:

 Logins[environment.samlIdpArn] = saml;
  AWS.config.region = environment.region;
  AWS.config.credentials = new AWS.CognitoIdentityCredentials({
    IdentityPoolId: environment.identityPoolId,
    CustomRoleArn: environment.roleSelectedArn,
    Logins
  });
 
  let tmp = this;
  (<AWS.TemporaryCredentials>AWS.config.credentials).refresh(function (err) {
    if (err) {
      console.log("Error getting creds - check session");
      console.log(err.message);
      callback.isLoggedIn("No credentials", false);

    } else {

      console.log("Well, called refresh");

......

Thanks for your time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants