Fix \resolveUserFn\ typo authorization-authentication.mdx (#6093)

This commit is contained in:
Arda TANRIKULU 2024-12-11 14:02:13 +03:00 committed by GitHub
parent 8554e2f62b
commit fcecd08bfc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -629,7 +629,7 @@ export const gatewayConfig = defineConfig({
// Then set generic auth plugin to use granular mode
mode: 'protect-granular',
// Set where to extract the payload
resolveUser: ctx => ctx.jwt?.payload,
resolveUserFn: ctx => ctx.jwt?.payload,
// If you want to continue execution even if some fields are rejected
rejectUnauthenticated: false
}
@ -674,11 +674,10 @@ this behavior by providing a custom `extractScopes` function.
```ts
{
resolveUserFn,
validateUser,
mode: 'protect-granular',
// Set where to extract the payload
resolveUser: ctx => ctx.jwt?.payload,
resolveUserFn: ctx => ctx.jwt?.payload,
extractScopes: jwtPayload => jwtPayload?.scopes // Expected to return an array of strings
}
```