How to authenticate a curl request in my app?

79 views
Skip to first unread message

Bilal Haidar

unread,
Jun 14, 2021, 1:37:09 PM6/14/21
to Google App Engine

Hello,

I've added a step to curl into an endpoint in my app as follows:

name: gcr.io/google.com/cloudsdktool/cloud-sdk
entrypoint: "bash"
args:
- "-c"
- |
RESPONSE=$(curl -o /dev/null -s -w "%{http_code}" -H "X-AppEngine: 1" $_APP_BASE_URL)
if [ "200" != "$$RESPONSE" ];
then
exit 1;
fi

I would like to authenticate this request on my app level.

What are my options?

To generate a token, store it inside Secret Manager and inside my DB or env variables. Pass the token via header (get) or payload (post) and then compare the two?

Any more secure ways of doing this?

Thanks
Bill

David (Cloud Platform Support)

unread,
Jun 15, 2021, 4:56:44 PM6/15/21
to Google App Engine

Hello,

As you mentioned, a good way of doing this would be using secret manager. This is the official document that explains how to use secret manager and should help you in getting your curl to work properly.

Bilal Haidar

unread,
Jun 15, 2021, 5:13:21 PM6/15/21
to google-a...@googlegroups.com
Thanks a lot 

On 15 Jun 2021, at 11:57 PM, 'David (Cloud Platform Support)' via Google App Engine <google-a...@googlegroups.com> wrote:


--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/a9QBvtnYwhc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/43b093a9-cab0-450d-9293-d6cc76efae90n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages