Amplify CLIでCognito UserPoolsのトリガー関数を実装する
そういえばできるのかなと思ったのでちょっと調べてみました。 作成済みの場合はamplify auth update 作成済みであれば、amplify auth updateでwalkthrough all the aut […]
広告ここから
広告ここまで
そういえばできるのかなと思ったのでちょっと調べてみました。
作成済みの場合はamplify auth update
作成済みであれば、amplify auth update
でwalkthrough all the auth configurations
を選びます。
$ amplify auth update
Using service: Cognito, provided by: awscloudformation
What do you want to do? Walkthrough all the auth configurations
いろいろ項目の確認を進めていく中で、カスタム認証を付けたい場合は、この項目で設定しておきましょう。
$ Do you want to enable any of the following capabilities? (Press to select, to toggle all, to invert
selection)
◯ Add Google reCaptcha Challenge
◯ Email Verification Link with Redirect
◯ Add User to Group
◯ Email Domain Filtering (blacklist)
◯ Email Domain Filtering (whitelist)
❯◯ Custom Auth Challenge Flow (basic scaffolding - not for production)
◯ Override ID Token Claims
トリガー関数についてはDo You want to configure Lambda Triggers for Cognito
でy
と答えると設定できます。
? Do you want to configure Lambda Triggers for Cognito? (Y/n) y
? Which triggers do you want to enable for Cognito (Press to select, to toggle all, to invert selecti
on)
❯◯ Learn More
──────────────
◉ Create Auth Challenge
◯ Custom Message
◉ Define Auth Challenge
◯ Post Authentication
◯ Post Confirmation
◉ Verify Auth Challenge Response
(Move up and down to reveal more choices)
? What functionality do you want to use for Create Auth Challenge (Press to select, to toggle all, to
invert selection)
❯◯ Learn More
──────────────
◯ MFA w/ Captcha (Creation)
◉ Custom Auth Challenge Scaffolding (Creation)
◯ Create your own module
ファイルはamplify/backend/function/
{APP_NAME}{FUNCTION_NAME}
作成したファイルはこのようなパスで配置されます。
Untracked files:
(use "git add …" to include in what will be committed)
amplify/backend/function/ionicamplifyexample3af4138e3af4138eCreateAuthChallenge/
amplify/backend/function/ionicamplifyexample3af4138e3af4138eDefineAuthChallenge/
amplify/backend/function/ionicamplifyexample3af4138e3af4138eVerifyAuthChallengeResponse/
package.json
もそれぞれで配置されていますので、ライブラリを追加する場合はそちらに追加しましょう。
参考
ブックマークや限定記事(予定)など
WP Kyotoサポーター募集中
WordPressやフロントエンドアプリのホスティング、Algolia・AWSなどのサービス利用料を支援する「WP Kyotoサポーター」を募集しています。
月額または年額の有料プランを契約すると、ブックマーク機能などのサポーター限定機能がご利用いただけます。
14日間のトライアルも用意しておりますので、「このサイトよく見るな」という方はぜひご検討ください。
広告ここから
広告ここまで