Amazon-cognito-identity-js: IdentityPoolId & UserPoolId examples

Created on 20 Jan 2017  路  9Comments  路  Source: amazon-archives/amazon-cognito-identity-js

https://github.com/aws/amazon-cognito-identity-js/tree/master/examples/babel-webpack

I've setup a pool on https://ap-northeast-2.console.aws.amazon.com/cognito/users/?region=ap-northeast-2#/pool/ap-northeast-2_3m64mS9ch/details?_k=65jjty but it's not clear how the console's
Pool Id & Pool ARN map to IdentityPoolId & UserPoolId.

Can you perhaps show newbies exactly where to find these values?

Most helpful comment

Hi,

Pool Id (from your url, ap-northeast-2_3m64mS9ch), is the UserPoolId. The pool ARN is just the fully qualified identifier for that pool, it contains the user pool id. The user pool id is visible when you click into the pool in the console by 'Pool Id', and, as I mentioned, in the URL.

The identity pool id is a totally different resource than the user pool id. It identifies an identity pool, which is an entity for Cognito federated identities, a different service than Cognito user pools. To do this, click 'Manage Federated Identities' on the Cognito console landing page, and create one. Once you've done so, the identity pool id can be seen in the url, in the sample code given after the pool was created, and also inside the 'Edit Identity Pool' page (visible from the identity pool's specific page).

Don't let the similar naming confuse you, they're different resources from different branches of Cognito.

All 9 comments

Hi,

Pool Id (from your url, ap-northeast-2_3m64mS9ch), is the UserPoolId. The pool ARN is just the fully qualified identifier for that pool, it contains the user pool id. The user pool id is visible when you click into the pool in the console by 'Pool Id', and, as I mentioned, in the URL.

The identity pool id is a totally different resource than the user pool id. It identifies an identity pool, which is an entity for Cognito federated identities, a different service than Cognito user pools. To do this, click 'Manage Federated Identities' on the Cognito console landing page, and create one. Once you've done so, the identity pool id can be seen in the url, in the sample code given after the pool was created, and also inside the 'Edit Identity Pool' page (visible from the identity pool's specific page).

Don't let the similar naming confuse you, they're different resources from different branches of Cognito.

Thanks... figured it out. Be awesome if you could flesh out https://github.com/aws/amazon-cognito-identity-js/tree/master/examples/babel-webpack with implemented examples instead of having them in the README.

  • Confirming registration code
  • Sign in
  • Sign out
  • Password reset

etc etc!

I'm sorry but I have the same problem and I could not understand it yet.

With this url:
https://console.aws.amazon.com/cognito/users/?region=us-east-1#/pool/us-east-1_SovB8fiRm/details?_k=25a38a

Pool Id: us-east-1_SovB8fiRm
Pool ARN: arn:aws:cognito-idp:us-east-1:507863305258:userpool/us-east-1_SovB8fiRm

So my config is:

export default {
  region: 'us-east-1',
  IdentityPoolId: '507863305258',
  UserPoolId: 'us-east-1_SovB8fiRm',
  ClientId: '4makg4kbaf49bt2pdm2vlrhkcm',
}

And I only receive:
Exception

@jcthalys IndentiyPoolId is a different resource. you will get it in Federal Identities(Google,FB,SAM,etc). You will have to create one. The one you are entering is wrong.

I've added facebook but I only see "Facebook app ID" and "App secret".

This Cognito system is extremely complicated and the documentation is really poor. I am also having trouble understanding how to fix problems I am facing. This page has already helped up to a point but I am still stuck....

  • I think I did find the correct IdentityPoolID. Though, I wonder what the _poolId_ under _CredentialProvider_ is in the awsconfiguration.json file is. Is it still different from this IdentityPoolID? It does not have the same hexadecimal code, but fits the same format.
  • I am getting InvalidIdentityPoolConfigurationException and the error message says it is due to: _Invalid identity pool configuration. Check assigned IAM roles for this pool._ I have gone to assign roles, but I did not have the error before assigning roles. The console seemed to indicate that I should assign role (with a red box telling me to do so before I did it). Now that I have done it, I get this exception thrown.

It would be great to have a complete check list of things to do to get this system working. With some graphs explaining the relations between those confusingly similarly named entities...

I got it setup in my case. By default I didn't have a "federation" so I had to add one associated to my pool.

Then I hit edit and got my ID.

It's a little bit weird. The federation type is advertised as something to handle logging in via Facebook, Google, ect. But I needed it to run this example even though I'm not using any of those features.

I have it working but I'm still wondering do I need a federation to use cognito?

@kirkins did you find our more information about this? I'm running into the same thing, where I just want to authenticate with Cognito, and I don't want to use a federated provider, but I need an identity pool.

@stevewillard I got to the point where I had logging in with email (using link for verification) working.

I switched to Firebase Authentication. Completely free with no limit, easy to setup auth, and social login worked too.

https://firebase.google.com/docs/auth/

Was this page helpful?
0 / 5 - 0 ratings