How can I get other cognito user attributes like created_at? - amplify-js

Which Category is your question related to? Authentication

What AWS Services are you utilizing? Cognito

Provide additional details e.g. code snippets I can get the user sub, email, and other attributes like first_name by doing this

const user = await Auth.currentAuthenticatedUser()

However, I can't find any way to get the created_at datetime.

Asked Oct 02 '21 22:10
avatar flybayer

4 Answer:

@flybayer hi, the only way to achieve that data is to use the AdminGetUser API provided by Cognito team: which is not available when using Amplify.

Answered Mar 05 '19 at 22:35
avatar  of powerful23

@flybayer you could use the admin API suggested by @powerful23 and then store the result as a custom claim in your token during the pre-token generation Cognito trigger. Then you could just access it from the token like any other claim.

Answered Mar 09 '19 at 17:34
avatar  of jkeys-ecg-nmsu

@flybayer I am going to close this issue. Please let us know if you want to reopen it.

Answered Mar 28 '19 at 23:38
avatar  of powerful23

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

Answered Jun 13 '21 at 00:08
avatar  of github-actions[bot]