System Information
- Strapi Version: 4.1.10
- Operating System: OSX
- Database: MySQL
- Node Version: v14.16.0
- NPM Version: v8.10.0
- Yarn Version: -
In Strapi v3 it was possible to use the role attribute of the authenticated user from the response-json directly after the login to use it for some authorization things in frontend. At that time the role attribute was populated OOTB.
Since Strapi v4 the role attribute is not populated anymore. Now i’m searching for a clean way to bring back the role attribute within the “auth/local” response body again.
I already extended the “plugin.controllers.auth.callback” to get the populated role with the user, but the sanitizing of the contentAPI (sanitize.contentAPI.output(user, userSchema, {auth})) is removing the role again. I want to keep the sanitizer. So I need to adjust the schema of the user content-type to prevent the sanitizer from removing the role. But how?
Do you have any ideas or know any other solutions for that?
Thank you