How to extend auth controller in v4!?

<@713148383342100552> I think that doesn’t help me too much, first of all I want to say that I already have a custom route set, where from my backend I make a request to my own backend to /auth/local if it’s a 200 the cookie is set.

The problem is how to obtain that cookie, i use a global middleware that takes the jwt of the cookie and sets it in the headers, but sets a Bearer token in each route even if it is not authenticated and when sending an authorization header to a public route this returns a 403, for example every time I reload the strapi admin home page it triggers the middleware for anything. I solved this by excluding urls that start with /admin /content-manager etc but it is a very “manual” fix and I honestly don’t like it very much!! I don’t see that there is an official way to implement this. And I don’t know if there is any way to implement my middleware at a lower level and not globally. The issue is that if I set the middleware at the api level, I have to put my middleware file in all the collections I have from my api?? From what I understand I can’t call 1 single middleware file from different api collections