Authentication on Strapi

This is intended by default, for performance, we only populate the role relation. You can use the plugin extensions to modify the users-permissions plugin to adjust the population.

See the following code, you just need to add your 'user-groups' field to the array like ['role', 'user_groups']

Hi ,

I am not able to find fetchAuthenticatedUser(id) method . how to customize it?

please update me

Thanks!

The plugin extensions troubleshooting link I mentioned explains that we use a similar system to react ejections. Those functions are by default in the node_modules so you must create the file/folder path yourself and mirror the file contents to make changes.

Keep in mind that by doing so, you will need to keep that file up to date manually for every version update major or minor.

1 Like

Hi vclsystem, you said, “I have corrected Auth.js. Now i can able to login”
I’m getting the same 400 error that you mentioned above.

Can you please share what you did to correct that 400 error?

Thanks,

Rich

I have issue with login …
When i use postman with wrong password i have full error data with error status code of 400 and messages and …

but when i want to do this in my code i can not see that messages and see only 'bad request"

this is part of my code :

loginUser(values).then((res) => console.log(res)).catch((err) => console.log(err));

and this is my login api:
export const loginUser = (user) => {
return axios.post(${config['local-auth']}/local, user);
};

and this is my config.json file :
{
“nobatet-auth-api”: “https://nobatet.ir/auth”,
“local-auth”: “http://localhost:1337/auth
}

this is my error in console :

Error: Request failed with status code 400
at createError (createError.js:16)
at settle (settle.js:17)
at XMLHttpRequest.onloadend (xhr.js:54)

You need to log the whole res to see the error, try using a catch{}error(e){console.log(e)} block

Problem solved … axios reject promise with response property not message or simple error…

I have to log (error.response…)

1 Like