0
votes

I am new to Google App Engine services. I have a Java Maven project with one module running on app engine flex and other on app engine standard. I am using JWT authentication for App Engine Flex APIs. I want to make a post request from App Engine Standard to App Engine Flex. What should be the best way to authenticate the service?

Also, I have a cron service hitting a particular URL I am using for some backend stuff. How can I authenticate that the request has came from Cron service only?

1
Do not edit a question to transform it into an entirely new, unrelated question. - user2357112 supports Monica

1 Answers

1
votes

For checking if the job is coming from the Cron service (assuming you are using the requests module):

is_cron = request.headers.get('X-Appengine-Cron', False)
if not is_cron:
    return 'Bad Request', 400

If you are using another module, you just have to check the header from the cron job to make sure it is 'X-Appengine-Cron'

Source: https://cloud.google.com/appengine/docs/standard/python/config/cronref#cron_requests