Skip to content

sanitizeUser

sanitizeUser(fields?): HookFunction

Defined in: sanitize-user.ts:14

Strip sensitive fields from a result before it’s serialized back to a client.

Gated on context.params.provider, the same “no provider = internal/trusted call” convention authenticate() uses — an unconditional strip would also scrub results returned from internal calls, breaking @mantlejs/auth-local’s credential lookup (it reads the stored password hash off app.service("users").find(...) to verify against, and that call shares this same service’s after hooks).

string[] = DEFAULT_SENSITIVE_FIELDS

HookFunction