0

In my single page application once I login with FeathersJS authentication I am passing my JWT token to the server for further service requests . In my service hook I am using authenticate("jwt") to check for authentication . It is working perfect , but also populating context.params.user with the user information . So authenticate("jwt") calling user get service for every API call which has authentication enabled .

1) If I don't need any user information other the the user ID can I avoid this user get service call ? Or is there any other specific reason to populate user object ?

2) By avoiding the above call , Can I just populate context.params.user only with the ID ( From the JWT token? )?

Thank You

Bujji
  • 1,717
  • 10
  • 41
  • 66

1 Answers1

3

There's no way to avoid populating the user object right now unless you want to extend various internals of feathers authentication to do so.

ccummings
  • 356
  • 1
  • 4
  • Thank You @ccummings for your response . I thought there will be some flag , But thats fine . What I want to avoid is one extra call to the database for each request . – Bujji Apr 20 '19 at 22:50