Is there a way to set custom authentication on GCP API Gateway?

I've been looking into GCP API Gateway to be the entrypoint of our back-end system, composed of some Cloud Run, Pub/Sub and Firestore instances. I thought the gateway would be good for, among other things, being a central place for validating authenticated requests.

GCP offers some methods but none of them allows the developer to build a code implementation of what their authorization proccess should be. The idea would be to check for a secret on the header we give each of our clients and check some information about it on our database, like expiration date and some other things.

I'd like to know if there is a way to set a custom authentication by code and configure the API Gateway to handle it normally as it seems to do with the other options they provide.


Unfortunately the GCP API Gateway does not provide such option for custom authentication, in order to authenticate using the API Gateway you have to use one of the alternate authentication methods provided in the documentation.