Open walshe opened 6 years ago
@walshe I don't think there is a direct way. But there is a hack that we use internally. The cognitoAuthenticationProvider
is basically the User Pool Id of the user that you can use to get the attributes. It is formatted a bit weirdly but you can parse it out and use it.
actually I just see its all contained in payload session.getIdToken() on the client, so I could pass it it from there
this cognito api is so confusing
by the way, in the notes api how come you associate a note with a cognitoIdentityId rather than the 'sub' which is at the end of the cognitoAuthenticationProvider field
"cognitoAuthenticationProvider": "cognito-idp.us-east-1.amazonaws.com/us-east-1_Wg0Dp2n5r,cognito-idp.us-east-1.amazonaws.com/us-east-1_Wg0Dp2n5r:CognitoSignIn:c45b94b4-57e5-41gc-86c3-6ed5e41212359",
The reason i say this is because when it comes to lokoing up users in the cognito console, then they all get listed there by sub, with no sign of a cognitoIdentityId at all . @jayair
@walshe It can be done either way. But say you had multiple auth providers (Facebook and Google); the Identity Id gives you a unified id for the user.
I see. Btw @jayair whats your opinion on this as a way to get info on a user groups and attributes.. here is what I am doing:
I pass the email addr from frontend (used in the login form) to a protected lambda. In there i use email param to:
@walshe Yeah that makes sense. I haven't tried it but it looks okay.
or any thing else in the request..
I know I could pass in the email address from the frontend and use adminGetUser() but wondered if theres a way using the default stuff passed to the lambda event: