Plugin Strapi : want to access data with a specified locale

System Information
  • Strapi Version: 4.1.8
  • Operating System:
  • Database:
  • Node Version: 14.19.1
  • NPM Version: 6.14.16
  • Yarn Version:

Hello !
I created a Plugin to export data and I want that the user can select a langage for the data to export. But when I do a request in my code to /api/{content-type}?locale=en, I’m ejected from the backend and I need to log back and no data has been exported.
But when I go to the same address in my browser, it returns me the data in Json and all is authorized to recover the data in the settings so I don’t understand this comportment…

Thanks for your further help