LoginSignup
2
1

More than 5 years have passed since last update.

AWS Amplifyのユーザー認証でユーザー名の代わりにメールアドレスを使用する

Posted at

はじめに

AmplifyとReactを使用して爆速でユーザー認証画面を実装するの内容に沿ってユーザー認証を実装すると、メールアドレスの他にユーザー名が必須となり、ログイン時にもユーザー名の入力が必要になる。そこで、メールアドレスでログインできるようにしたい。

参考: https://github.com/aws-amplify/amplify-js/issues/1634

手順

設定ファイルの作成

amplify add auth

pushする前に、amplify/backend/auth/{your-project}/{your-project}-cloudformation-template.ymlにUsernameAttributesを追記する。

Type: AWS::Cognito::UserPool
    Properties:
      UsernameAttributes:
       - "email"
      UserPoolName: !Ref userPoolName
amplify push

push後は変更が効かないので注意が必要。

2
1
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
2
1