Thank you for yur answer, Peter.
I already followed that guide, it brought me to the current situation. I'm not 100% sure of it, but it seems that the non-expiring token can be obtained only if the app is in the production status, while mine is in the testing status. Is that correct?
If it is, switching to production would mean creating a dedicated privacy policy page, a video, and possibly something else. This will require time, likely some days of work for my company, for something nobody will ever need.
If it isn't, then I probably did something wrong previously, and I will try again from scratch.
At the moment the script is working, but if the refresh token expires next week, it means I will have to dedicate every week some time to this task, and I can't have the company depend on me in this way. It's wrong for them, and it's wrong for me.
Best
Davide