awsdocs / aws-doc-sdk-examples

Welcome to the AWS Code Examples Repository. This repo contains code examples used in the AWS documentation, AWS SDK Developer Guides, and more. For more information, see the Readme.md file below.
Apache License 2.0
9.42k stars 5.6k forks source link

Cognito UI Example. #1070

Closed rwlouks closed 4 years ago

rwlouks commented 4 years ago

I would like to use the Cognito User Pool Hosted UI to have users log in and then be able to access other AWS services through the AWS JavaScript SDK (for Browsers)

I would like an example of browser JavaScript code that is called from the Cognito hosted UI that sets the appropriate AWS credentials so I can make calls to other AWS services such as IoT.

[List the AWS service(s) that this code example should use, if you know them.]

Cognito IoT *

Which AWS SDKs or tools, if known, should this code example use?

[List the AWS SDKs or tools that this code example should use, if you know them.]

JavaScript (for browsers) *

Are there any similar code examples that could be leveraged?

[List any similar code examples that already exist in the Code Catalog, if you know of any.]

aws-doc-sdk-examples/javascript/example_code/cognito/cognito_getcreds.html aws-doc-sdk-examples/javascript/example_code/browserstart/polly.html *

Any other related details we should know about?

Both of the listed similar code examples use unauthenticated users. I would like to use the cognito hosted UI to authenticate the users.

brmur commented 4 years ago

Thanks for submitting your code example request. I've added it to our wish list. In the meantime, you may find this AWS Docs page useful https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-integrating-user-pools-with-identity-pools.html . It describes how you can enable your users to sign-in with a user pool, and then access AWS services using an identity pool.