I am using the amazon-cognito-identity-js library to create a new user in Amazon Cognito, but I cannot view the properties of the class CognitoUserPool.
My application is Nuxt3 using Pinia.
Steps that I have taken
- npm install --save amazon-cognito-identity-js
- Created Pinia Store
- Imported { CognitoUserPool} from 'amazon-cognito-identity-js'
- Created const for CognitoUserPool
When I try and set the poolData that consists of the UserPoolId and ClientId the properties do not show up for CognitoUserPool.
Here is my code.
import { defineStore } from 'pinia'
import {CognitoUserPool,} from 'amazon-cognito-identity-js'
export const useCognitoAuthStore = defineStore('CognitoAuthStore', () => {
const cognitoUserPool = ref({} as CognitoUserPool)
}
async function signup() {
//The property UserPoolId is not being recognized.
cognitoUserPool.UserPoolId
}
Am I not instantiating my const correctly for Typescript?
After further research I found an article that stated amazon-cognito-identity-js may be deprecated in the future. So I learned of a different solution using AWS Amplify auth backed by AWS Cognito for a Nuxt3 app.