Skip to content
This repository was archived by the owner on Feb 24, 2018. It is now read-only.
This repository was 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
@ghost

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions