1 Answer
- Newest
- Most votes
- Most comments
1
You can't directly destructure it like you do with built-in attributes because of the colon in its name. Instead, access it using bracket notation. Here’s how you can do it:
const userAttributes = await fetchUserAttributes(); const category = userAttributes["custom:category"];
Relevant content
- asked 8 months ago
- asked 7 months ago
- asked 5 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 2 years ago
I did it using : "const { tokens, credentials, identityId, userSub } = await fetchAuthSession(); const { idToken, accessToken } = tokens; idToken.payload['custom:category']" but I prefer your way. Thank you !