DEV Community

Discussion on: How to make nuxt auth working with JWT - a definitive guide

Collapse
 
jeremymen profile image
JeremyMen

Hello, thanks for this post, it helps me a lot.
Just a question: I need to pass a param to user url to get the user. I need to do something like that:

strategies: {
  local: {
    endpoints: {
      login: { ... },
      logout: false,
      user: { url: '/users/:userId', method: 'get', propertyName: 'data' }
    }
  }
Enter fullscreen mode Exit fullscreen mode

so how can I pass userId params to get the user?
Thanks

Collapse
 
mrnaif2018 profile image
MrNaif2018

Hello! You should implement something like /users/me in your backend to just return current user. Unless you JWT token has user id in, it is impossible to fetch that endpoint as it fetches user data(with user id in it).