Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use Amazon Cognito as user authentication for my website (NOT mobile app) [closed]

How can I use AWS-Cognito for user authentication in a web app (not IOS or Android app)?

Amazon cognito just came out:

http://aws.amazon.com/cognito/

http://aws.amazon.com/about-aws/whats-new/2014/07/10/introducing-amazon-cognito/

From the FAQ:

Q: Do I still need my own backend authentication and identity systems with Amazon Cognito?

No. Amazon Cognito supports login through Amazon, Facebook and Google, as well as providing support for unauthenticated users. With Amazon Cognito you can support federated authentication, profile data sync store and AWS access token distribution without writing any backend code.

It seems to be built with mobile apps in mind (they provide SDKs for android and IOS).

So far the AWS php SDK and boto don't reference Cognito, but Amazon mentions "back-end API's" that we can hit.

like image 815
Nate Avatar asked Jul 10 '14 16:07

Nate


People also ask

Can AWS Cognito be used for authorization?

You can use Amazon Cognito to control permissions for different user groups in your app. This ensures that users have appropriate access to backend resources, determined by the group they belong to. Amazon Cognito makes it easier for you to manage user identities, authentication, and permissions.

How can you use Cognito to provide security to a user?

Amazon Cognito enables simple, secure user authentication, authorization and user management for web and mobile apps. With Cognito, a user or visitor can sign in with a username and password through Amazon, or through a third party like Facebook, Google or Apple.


3 Answers

One of the developers for Amazon Cognito here.

To expand on JeffersonBe's answer, API docs for both the Identity and Sync services in Amazon Cognito are available on our documentation website.

Additionally, a number of the AWS SDKs have already been updated to support Amazon Cognito:

  • PHP
  • JavaScript
  • Java

With more coming soon.

Thanks for your interest. If you have other questions or encounter issues, please post additional questions here on SO or over at our new dedicated Cognito forum.

like image 59
Bob Kinney Avatar answered Sep 30 '22 00:09

Bob Kinney


Cognito is perfect for web apps. There is a good tutorial on using Cognito ID and Sync for Javascript web apps: http://backspace.technology/learn-aws-cognito.html and at http://blog.backspace.academy/2015/03/using-cognito-with-node.html

Update: There is now a Cordova/PhoneGap tutorial also at http://backspace.technology/learn-aws-cognito-id-phonegap.html and at http://blog.backspace.academy/2015/03/using-cognito-with-phonegapcordova-part.html

The process is as follows:

  1. Register a Facebook app. You will get a App ID and App secret.
  2. Create an AWS Cognito ID Pool using the App ID and App secret.
  3. Use the App ID and secret with Passport to get a Facebook session token for the user.
  4. Use the Facebook token to get temporary AWS credentials for the user.
  5. Use the temporary credentials to access AWS resources such as Cognito Sync.

Although if you are only looking for authentication then you don't actually need Cognito, you just login with Facebook.

like image 21
user3393285 Avatar answered Sep 29 '22 22:09

user3393285


From what I see in their FAQ, yes:

Q: Does Amazon Cognito expose server-side APIs?

Yes. Amazon Cognito exposes server-side APIs. You can create your own custom interface to Amazon Cognito by calling these APIs directly. The server-side APIs are described in the Developer Guide.

Here are the links to the relevant Amazon Cognito Documentation:

  • Amazon Cognito Identity API Reference
  • Amazon Cognito Sync API Reference
like image 42
JeffersonBe Avatar answered Sep 29 '22 22:09

JeffersonBe