aws-sdk/clients/cognitoidentityserviceprovider getUser() with v3 aws-sdk

0

In order to retrieve the Cognito User Pool user attributes from an access token, in my nodejs backend, I usually install "aws-sdk" and import the package "aws-sdk/clients/cognitoidentityserviceprovider" and many other aws-sdk packages.

Switching to @aws-sdk packages (v3) I replaced almost all imports with the new lighter ones but encountered a problem when I tried to find a replacement for the function getUser(). I cannot find any other function that when I pass the access token it then returns the user attributes object.

Current state example:

import CognitoIdentityServiceProvider from 'aws-sdk/clients/cognitoidentityserviceprovider'

const cognitoIdentityServiceProvider =
            new CognitoIdentityServiceProvider({
                apiVersion: '2016-04-18',
                region: 'eu-central-1',
            })

const userAttributes = await cognitoIdentityServiceProvider
            .getUser({
                AccessToken: token,
            })
            .promise()

So, how can I do it with the v3 SDK? Am I doing something wrong?

DMA Srl
질문됨 2년 전269회 조회
1개 답변
1
수락된 답변

Is it possible to use something like getUser() in CognitoIdentityProvider instead? At first glance, they appear to accomplish the same task.

AWS
답변함 2년 전
profile picture
전문가
검토됨 8일 전
  • I don't know how I missed it but thank you so much for this quick answer!

  • Not a problem!

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠