does anyone know how to get the federated identity...
# help
s
does anyone know how to get the federated identity pool ID (
us-east-1:<uuid>
) from
cognito.UserPool
?
f
Hey @Sam Hulick i’ve seen ppl either: • store identity pool id as a user pool attribute; or • store the user pool id to identity pool id mapping in DynamoDB
afaik, it’s not something the user pool or the identity pool track automatically
s
I should probably elaborate on what I’m trying to do: in the stack that creates the user pool, I’m trying to make an IAM role for a Cognito group. but it needs a reference to the identity pool ID:
Copy code
assumedBy: new iam.FederatedPrincipal('<http://cognito-identity.amazonaws.com|cognito-identity.amazonaws.com>', {
      StringEquals: {
        '<http://cognito-identity.amazonaws.com:aud|cognito-identity.amazonaws.com:aud>': '???',
      },
      'ForAnyValue:StringLike': {
        '<http://cognito-identity.amazonaws.com:amr|cognito-identity.amazonaws.com:amr>': 'authenticated',
      },
    }),
the
cognito.UserPool
instance doesn’t seem to have any relevant properties
f
how are u creating the identity pool? is it created by this point?
s
it apparently gets created when you create a user pool
or not? hang on
oh wait. nope
Copy code
const auth = new sst.Auth(stack, 'Auth', {
    cognito: {
      userPool,
      userPoolClient,
    },
    identityPool: { allowUnauthenticatedIdentities: true },
  });
oh duh.
auth.cognitoIdentityPoolId