amazon-archives / aws-cognito-angular-quickstart

An Angular(v5)-based QuickStart single-page app utilizing Amazon Cognito, S3, and DynamoDB (Serverless architecture)
https://cognito.budilov.com
Apache License 2.0
689 stars 302 forks source link

documentation improvement #66

Closed nelg closed 7 years ago

nelg commented 7 years ago

Hi,

I've found this project as linked from AWS Dev resources - https://aws.amazon.com/cognito/dev-resources/

It think it's excellent that it provides a sample, that works and does serverless login.

Could you please help however, by explaining a few things a little more:

  1. The deployment can deploy to EB or S3. With the EB deployment, please can someone add to the documentation what server side examples are in this project, and what files actually run on the server to make that happen.

  2. The code seems to have rekognition being added to it. A bit of documentation about what this is and what it does would be great. I see you have a second project about rekognition.

  3. As an outsider, trying to understand how to build a serverless application with login to Cognito, this sample app is great in that I can see it's possible, but also very complex, with lots of frameworks and things to learn. It is possible to document how it works, or have a very simple clear version, with no additional extras, or maybe something allowing this code to be used as a template for others.

vbudilov commented 7 years ago

Hi @nelg , in regards to your comments:

  1. This is meant to be a sample quickstart that you can play around with and see how it runs and operates. The best way to understand it is to deploy it and see the moving parts. The code might change, therefore making the documentation, especially this part, obsolete.
  2. Rekognition will no longer be added at this time.
  3. There are much better resources out there that explain all of the relevant frameworks/libraries that are used here. I suggest you spend some time searching for them and doing some research. I won't do it justice :)
ampersand-five commented 7 years ago

@vbudilov But it'd be nice to have some explanation on a few AWS things. Maybe a whole blog about how it's built, the code is very nice but there's parts that don't copy/paste and so an explanation would help, because here's an example of why I'm here looking for a solution:

I made an AWS Cognito user pool and I'm trying to login against it in my own Angular 4 web app. I'm following your code and in your src/app/service/cognito.service.ts you declare at the top:

declare var AWSCognito: any; declare var AWS: any;

And I've done the same thing and my AWS variable works, but the AWSCognito variable always shows undefined. I figured this is from the SDK and I compared mine to yours and that's where I'm now confused.

You have 5 different AWS SDK's in your /assets/js folder. When I made my Cognito user pool, AWS then said "Here, download this ONE mobile SDK in javascript" Which I did, and now I have one sdk simply named aws-sdk.js (and the aws-sdk.min.js, which I actually reference in my code).

Looking at my SDK file it says that it the AWS SDK for JavaScript v2.54.0. But in yours, you have amazon-cognito-identity.min.js, aws-cognito-sdk.min.js, aws-sdk-2.7.13.min.js, and the mobile analytics and s3 ones. So what happened here? Why do you have those three in particular and why did AWS only tell me to download one monolithic one? Where do I get the AWSCognito variable from?

Now, I can copy your sdk files, but I'd at least like to know why AWS didn't offer them to me or why I can't find them elsewhere or if they were merged into the one monolithic one, why that isn't mentioned anywhere easy to find.

ampersand-five commented 7 years ago

For anyone else who got frustrated before they looked deeper like I did = ), looks like it did get all moved into the one SDK:

let authenticationDetails = new AWSCognito.CognitoIdentityServiceProvider.AuthenticationDetails(authenticationData); -> It is now just in the AWS object, you'll notice that CognitoIdentityServiceProvider is in the AWS object so this works: let authenticationDetails = new AWS.CognitoIdentityServiceProvider.AuthenticationDetails(authenticationData);

Again, as to the point above though: it'd be nice to have documentation and this repository, the only linked example on AWS for Angular, to be updated to reflect these changes when or before they happen or at least marked somewhere saying "NEW SDK, this no longer is completely valid"

vbudilov commented 7 years ago

Hi @canada11 & @nelg ,

Here's a great resource that goes into details on what everything is and how to use it (the official Amazon Cognito Identity repo): https://github.com/aws/amazon-cognito-identity-js

Here's a blog post talking about some of the components: https://aws.amazon.com/blogs/mobile/accessing-your-user-pools-using-the-amazon-cognito-identity-sdk-for-javascript/

Hope this helps.

Vladimir