Accessing an admin endpoint of an classic appengine app from a script?

90 views
Skip to first unread message

Jens-Uwe Mager

unread,
Aug 29, 2016, 1:19:40 PM8/29/16
to google-appengine-go
I have been able in the past to use small scripts with cURL to perform some administrative downloading of data from my classic appengine app. But since some time now (do not know exactly, as I do not need the function often) these fail now. Is there any recipe anywhere on how to use cURL with google authentication? I used something like this previously:

eval `curl -s myAuthFile.txt -d Email=ad...@my.domain -d Passwd=xxxxx -d accountType=GOOGLE -d service=ah -d source=Google-remote_api-1.0 https://www.google.com/accounts/ClientLogin`

Any hints on how to modernize this?

Ronoaldo José de Lana Pereira

unread,
Sep 2, 2016, 1:25:11 PM9/2/16
to Jens-Uwe Mager, google-appengine-go
Hi Jens-Uwe, ClientLogin was discontinued a while back.

You could try passing a header like "Authorization: Bearer `gcloud auth print-access-token`" to your shell script (requires gcloud auth login to be executed first to store oauth credentials). Not sure if the endpoints you are making requests to will work. It will depend on what you mean by "administrative downloading of data from my classic appengine app".

If you mean Cloud Datastore, I strongly advise you to check out the sample code that allows you to access it directly via its new own API: https://cloud.google.com/datastore/docs/apis.

If you were using Remote API + ClientLogin before, it can be changed to use the Google Default Application Credentials, and it will pick up the gcloud authorization token for you. You can see a sample code of how to acomplish this here: https://github.com/ronoaldo/aetools/blob/master/aeremote/remote_api.go#L30 (Godoc: https://godoc.org/ronoaldo.gopkg.net/aetools/aeremote). The linked tool is a small program I wrote to be used both on localhost and on production appengine, and it exports/imports data to AppEngine datastore (small sizes only, not for big-data transfers; network + api requests charges will apply!).

Hope that helps!

Best regards,

--
You received this message because you are subscribed to the Google Groups "google-appengine-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine-go+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Ronoaldo Pereira
Reply all
Reply to author
Forward
0 new messages