Cognito - Sign-in

> AWS (Amazon Web Services) > Aws - Cognito

1 - About

The sign-in state

After users have a confirmed account, they will be able to sign in:

  • They gives their username (or email) and password.
  • On internet,:
    • a JavaScript function then communicates with Amazon Cognito, authenticates using the Secure Remote Password protocol (SRP), and receives back a set of JSON Web Tokens (JWT).
    • The JWTs contain claims about the identity of the user
    • The JWT is used to authenticate against the RESTful API (build with Amazon API Gateway)

3 - Implementation

Aws provides several implementation, one by library.

Amplify is the reference one.

3.1 - Amplify

A sign-in with the the javascript amplify sdk after installation and configuration

import Auth from '@aws-amplify/auth';
Auth.signIn(username, password)
  .then(success => console.log('successful sign in'))
  .catch(err => console.log(err));

3.2 - Js Identity

See sign-in

3.3 - Js Auth

The javascript auth library, see sign-in

The sign in form uses the cognito sign-in javascript.

4 - Redirect

For Sign in Redirect URI(s) inputs, you can put one URI for local development and one for production. Example: http://localhost:3000/ in dev and in production.