aws / aws-aspnet-cognito-identity-provider

ASP.NET Core Identity Provider for Amazon Cognito
https://aws.amazon.com/developer/language/net/
Apache License 2.0
215 stars 89 forks source link

Possible to retrieve user created date? #68

Closed andyfurniss4 closed 5 years ago

andyfurniss4 commented 5 years ago

Me again.

I can see in Cognito that there's a 'Created Date' field but I can't figure out how to get hold of this value programatically. It's not returned in the collection attributes and I can't see a method to get it explicitly. Is it possible?

assyadh commented 5 years ago

Hi,

Iirc, the creation date is not a cognito attribute, it is rather returned by calling the AdminGetUser api: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminGetUser.html

You can look into implementing this by yourself if you are in a hurry (for this, use the CognitoUserPool instance available through the ServiceCollection, it contains the pool id property).

I am pinning this issue to track adding it into the CognitoUser class and the FindBy* methods of the UserManager but can not give an eta

https://github.com/aws/aws-sdk-net-extensions-cognito/blob/master/src/Amazon.Extensions.CognitoAuthentication/CognitoUser.cs

tachyon1337 commented 5 years ago

This issue can be easily remedied by simply creating a created_at custom attribute and setting the value when creating the user.

assyadh commented 5 years ago

I'll close this, as a workaround is available, we may pull this into v2