Skip to content

Commit 23704ae

Browse files
simplify example and add some spacing
1 parent 5ed3b60 commit 23704ae

File tree

1 file changed

+3
-2
lines changed
  • src/pages/[platform]/build-a-backend/data/customize-authz/user-group-based-data-access

1 file changed

+3
-2
lines changed

src/pages/[platform]/build-a-backend/data/customize-authz/user-group-based-data-access/index.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ You can access a user's groups from their session using the Auth category:
178178
```ts
179179
import { fetchAuthSession } from 'aws-amplify/auth';
180180

181-
const { tokens } = await fetchAuthSession();
182-
const groups = tokens.accessToken.payload['cognito:groups'] || [];
181+
const session = await fetchAuthSession();
182+
const groups = session.tokens.accessToken.payload['cognito:groups'] || [];
183+
183184
console.log('User groups:', groups);
184185
```
185186
</InlineFilter>

0 commit comments

Comments
 (0)