Is there a way to ask for login instead of return 403?

Wanted to achieve similar features on some condition.

Please help in process if it can be achievable in strapi v4.

Thanks in advance