Auth endpoint /auth/local is over-fetching data - how to create custom controller?

I too faced similar problem so, I extended the Auth.js file

Steps you need to take
create this directory structure
/extensions/users-permissions/controllers/Auth.js

Go here and copy paste the whole file

On line 71 you will see a fetch query for user

const user = await strapi.query('user', 'users-permissions').findOne(query);

replace it with

const user = await strapi.query('user', 'users-permissions').findOne(query, []);

Empty array means it won’t populate any relation fields, if you want any relations fields to be populate, add their fieldName as string inside the array

2 Likes