Cannot see the properties of CognitoUserPool Class from amazon-cognito-identity-js Nuxt3

37 Views Asked by At

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

  1. npm install --save amazon-cognito-identity-js
  2. Created Pinia Store
  3. Imported { CognitoUserPool} from 'amazon-cognito-identity-js'
  4. 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?

1

There are 1 best solutions below

0
launchCode On

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.