I assume to modify the request and process 3rd party payload, you need something like https://openresty.org/en/ to write the logic in Lua.
If you just need to auth in incoming request in reverence proxy - ther is nginx module for that https://nginx.org/en/docs/http/ngx_http_auth_request_module.html