LoginSignup
3
2

More than 3 years have passed since last update.

AWS AmplifyのAuthenticatorでのSignUp時にPhone Numberを非表示にしたい

Last updated at Posted at 2020-12-13

やりたいこと

  • AmplifyAuthenticatorコンポーネントからのSignUp時、
    • EメールアドレスをUser名として利用したい
    • 電話番号フィールドを非表示にしたい

デフォルトではこのようになっている。

amplify-auth.jpg

やること

  • formFieldsでSign Upフォームに表示するカラムを指定する
  • username-alias にてEメールアドレスを usernameとして登録できるようにする
    • (注意事項) amplify add auth時にEメールでの登録を有効にしておく必要がある

最終的なコードは以下のとおり。

<template>
  <amplify-authenticator>
    <amplify-sign-out></amplify-sign-out>
    <amplify-sign-up
      slot="sign-up"
      username-alias="email"
      :form-fields.prop="formFields"
    ></amplify-sign-up>
  </amplify-authenticator>
</template>

<script>
export default {
  name: 'Auth',
  data() {
    return {
      formFields: [
        { type: "email" },
        { type: "password" },
      ]
    }
  }
}
</script>

amplify-auth.jpg

参考

ここにまとめたものは公式ドキュメントの以下のページにて解説されています。

Authenticate with email or phone number

Hiding form fields

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2