I am not sure about the technical term for what I am looking. However, I have done this in Laravel using middleware. I am trying to achieve same in WordPress RESTApi.
I am planning to make a site as a service using WordaPress rest api. That I will use for cross platform. Since anyone can access WordPress api it is too dangerous.
I want to block it for public and only who pass the access token (not JWT or oAuth) I wan to allow only them to access API. This how I can limit the access.
So if I make android app and pass the access token, it will have access but anyone who want to make app from my api they want be able to.
I hope I have explained it properly to understand. You can see my middleware code that might help to explain more.