SSO in Azure - failed login

Hello,

What methods should I use in order to display that an user is not authorized to access an app, assuming that the app is configured to authenticate against Azure AD (OAuth 2).

I just want to display a simple error message, otherwise I get endless redirects to /index and finally to /login pages.

Regards