FOSRestBundle icon indicating copy to clipboard operation
FOSRestBundle copied to clipboard

how to hidden user sensitive field?

Open devgogo opened this issue 13 years ago • 3 comments

i use fosuserbundle and fosrestbundle

but rest api return a user password,salt field

look like:

{"comments": "id": 1, "body": "xxx", "user": {"id": 1, "password": "xxxx", "salt": "xxx", "email": "xxx", .....}}

i need hidden password,salt field, how to do?

thinks.

devgogo avatar Nov 20 '13 07:11 devgogo

You need to tell the serializer to exclude those fields. Check http://williamdurand.fr/2012/08/02/rest-apis-with-symfony2-the-right-way/ for an example. (and it's a good read anyway in general ;) )

tonivdv avatar Nov 20 '13 07:11 tonivdv

Yes, please configure the serializer layer.

willdurand avatar Nov 20 '13 08:11 willdurand

ok, thx.

devgogo avatar Nov 21 '13 05:11 devgogo