初めに
入門中の React を使って Cognito のサインアップ・サインインのサンプルを作ってみました。
リポジトリは以下になります。
パッケージ
Cognito で認証機能を実装するには以下のパッケージが必要です。
npm install --save amazon-cognito-identity-js
npm install --save cross-fetch
import 'cross-fetch/polyfill';
import * as AmazonCognitoIdentity from 'amazon-cognito-identity-js';
使い方
必要なことは、以下のコードにユーザープール ID とクライアント ID を設定することです。
App.js
const poolData = {
// setting ids
UserPoolId: '',
ClientId: ''
};