简体   繁体   中英

Google Cloud Endpoints v2: Testing API key mechanism for an app-engine app executed on the local development machine

I'm a beginner in context of google-cloud-endpoints and the associated product "google-cloud-app-engine".

I've created a simple google app angine project/application and created an API-Key by using the google cloud platform's console.

To my app-engine's endpoints API definition I've added the annotation " apiKeyRequired = AnnotationBoolean.TRUE " as stated in Add API restriction by adding an API key to your app engine application

and my client application which uses the generated endpoints client API was also updated accordingly to send the generated API key for all API requests.

As I would like to test the "API-Key" mechanism locally on my development machine (using a local app-engine environment) before deploying the backend to the cloud, I would like to know, whether it is possible to test the "API-Key"-restrictions locally. I mean, somehow the locally executed app-engine backend app has to be aware of the created API key. Maybe there is a property which I have to provide to my app-engine backend application's POM.xml file...I don't know, whether the google app-engine SDK supports API keys for local testing in context of the "endpoints framework v2" actually. The newley introduced API Management Platform (API-Gateway) can maybe not be "simulated" locally...?!

Thank you so far for your effort!

API key restrictions should work locally. You just need to include GoogleAppEngineControlFilter in your web.xml .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM