cognitoを使ってユーザー認証を実装しようとしています。
管理者として作成したユーザー(初期パスのまま)のアカウントでログインしようとすると以下のようなエラーが出てしまいます。
どの関数が呼ばれてエラーが出ているのかまでは特定できましたがどうしてエラーになるのかが分からずお手上げ状態です。
こちらのコードがおかしいのでしょうか?
それともcognitoの設定がおかしいのでしょうか?
js
1Uncaught (in promise) TypeError: callback.newPasswordRequired is not a function 2 at CognitoUser.authenticateUserInternal (CognitoUser.js?1f53:466) 3 at eval (CognitoUser.js?1f53:348) 4 at eval (CognitoUser.js?1f53:330) 5 at eval (Client.js?0279:63)
js
1login (username, password) { 2 const userData = { Username: username, Pool: this.userPool } 3 const cognitoUser = new CognitoUser(userData) 4 const authenticationData = { Username: username, Password: password } 5 const authenticationDetails = new AuthenticationDetails(authenticationData) 6 return new Promise((resolve, reject) => { 7 cognitoUser.authenticateUser(authenticationDetails, { 8 onSuccess: (result) => { 9 // 実際にはクレデンシャルなどをここで取得する(今回は省略) 10 resolve(result) 11 }, 12 onFailure: (err) => { 13 reject(err) 14 } 15 }) 16 }) 17 }
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。