1
votes

Im Using User Pool, and is possible develop a api to communicate with AWS Cognito? or just to communicate with front-end apps (android, ios, javascript web)?

And if is possible, how can I identify the user logged and get their informations?

UPDATE 1: To get decode jwt informations: https://github.com/awslabs/aws-support-tools/tree/master/Cognito/decode-verify-jwt

UPDATE 2: Cognito is better to use on front-end, because you need store 'cognitoUser' object. And the methods is using this object.

UPDATE 3: You can do the login on backend, and use the token to use API Gateway on AWS. But the problem is if you need update something on Cognito. If you need, you can use the admin methods (https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/Welcome.html).

1
Yes it is possible, and I have a module already maid for it, with this module you can implement authentication using google, facebook, amazon in few hours say 5 to 6 hours. If you need more details, email me [email protected]hashed_name

1 Answers

1
votes

Yes of course it's possible, here is a sample example to use cognito with facebook login on node : https://gist.github.com/pcoady/8afab5defb89f1900c9b

You can also check this step by step tutorial from backspace.academy (3 parts)

From another stackoverflow answer :

The ID Token that you exchange with Cognito federated identity service to get the identity id and credentials already has all user attributes. You do not need an extra call to any service.

It is a JWT token and you can use any library on the client to decode the values. You can read this guide for more information about the tokens vended by Cognito user pools.

Alternatively, you can also use the Access Token to call GetUser API which will return all the user information.

You can check this code to retrieve the cognito IDToken with nodejs