I have build a mobile backend for my android application using google cloud endpoints (version 1, using android studio). I wish to authenticate my users via email/password, so I am using Firebase Authentication to do so. The Firebase Authentication sdk allows me to get each user's token on the client side (in android), and the firebase admin sdk allows me to check the validity of a token on the backend. I understand that in cloud endpoints I can provide my own custom authenticator (see: Google Cloud Endpoints and user's authentication), and I plan to call the firebase admin sdk within my custom authenticator to verify the user's presented token.
My problem is, since I am using google cloud endpoints to build my backend, I do not know where to insert the code to do the initialization of the firebase admin object that is required before I can verify any tokens. In a regular app engine environment, you would do this initialization in the init() method of the HTTPServlet (see https://github.com/GoogleCloudPlatform/firebase-appengine-backend/blob/master/src/main/java/com/google/cloud/solutions/flexenv/backend/MessageProcessorServlet.java ), but cloud endpoints hides this from you by automatically supplying a "SystemServiceServlet" as the HTTPServlet. I have tried subclassing the SystemServiceServlet and overriding the init() method, but then deployment of the endpoint to app engine fails since, apparently, creation of the android client libraries requires that there must be a SystemServiceServlet used (and it must be named "SystemServiceServlet").
I could do the initialization of the firebase admin app in each of the api methods that cloud endpoints provides (e.g., in the insert method of my api), but this seems like it would be extremely inefficient. How would I go about using the Firebase admin sdk in a backend built using google cloud endpoints?
Thanks very much for your time