User assigned to a group which does not have an access to app should not able to login

We have set up user management with group functionality with 2 groups likely “WEBUSER”(this group for website users) & “APP USER”(this group for android app users).
When we try to login using WEBSITE with APP USER credentials, we are getting an error below.
Ideally, it should not be redirected because the user is invalid to access it. And login should fail with message invalid user.
Please look at the attachment below.

I don’t see an attachment with your question, but if I understand correctly, you want people who are not authorized to access WEBSITE with APP USER credentials to receive a “Invalid User” vs a “Unauthorized” error.

You’re getting this error of course because Okta is (in my opinion) an identity management system, not an access entitlement system. When the identity is valid, and the access is denied, the default message is correct – you’re not authorized to the application.

Your best way around this is to deploy your own custom error page for accessing this application. There you are able to customize the error message appropriately.

Sorry missed the attachment