AppEngine - remote API returning 401 and too much-auth

I am trying to connect to an instance of AppEngine with a remote API with something like this:

os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = ".../path/to/key"
remote_api_stub.ConfigureRemoteApiForOAuth(
    server.encode('ascii'), path, secure=True
)

Where path/to/keypoints to the JSON file created in the Google Cloud (beta), API Manager → Credentials → Add Credentials → Service Account . Can Edit service account in the Permissions panel .

When I run this, I get this error on the console corresponding to 401 (as indicated in the App Engine log viewer):

  File "/usr/local/share/app-engine-python/google/appengine/ext/remote_api/remote_api_stub.py", line 768, in ConfigureRemoteApiForOAuth
    rpc_server_factory = rpc_server_factory)
  File "/usr/local/share/app-engine-python/google/appengine/ext/remote_api/remote_api_stub.py", line 835, in ConfigureRemoteApi
    app_id = GetRemoteAppIdFromServer (server, path, rtok)
  File "/usr/local/share/app-engine-python/google/appengine/ext/remote_api/remote_api_stub.py", line 569, in GetRemoteAppIdFromServer
    response = server.Send (path, payload = None, ** urlargs)
  File "/usr/local/share/app-engine-python/google/appengine/tools/appengine_rpc_httplib2.py", line 258, in Send
    NeedAuth ()
  File "/usr/local/share/app-engine-python/google/appengine/tools/appengine_rpc_httplib2.py", line 234, in NeedAuth
    RaiseHttpError (url, response_info, response, 'Too many auth attempts.')
  File "/usr/local/share/app-engine-python/google/appengine/tools/appengine_rpc_httplib2.py", line 85, in RaiseHttpError
    raise urllib2.HTTPError (url, response_info.status, msg, response_info, stream)
urllib2.HTTPError: HTTP Error 401: Unauthorized Too many auth attempts.

I checked and the correct credentials seem to be set in /google/appengine/ext/remote_api/remote_api_stub.py:760and should be passed to the remote api.

app.yamlhas a basic setting - remote_api: onfor builtins.

This setting works for local dev_appserver.py, so I am convinced that the problem is related to the Google / Cloud server settings.

I tried both authentication schemes in App Engine → Settings → Application Settings (Google Accounts API and Google Apps Domain).

Google, , , , - ?

, , :

$ GOOGLE_APPLICATION_CREDENTIALS=~/path-to-key
    remote_api_shell.py -s APPID.appspot.com --secure APPID

401.

+3
2

, :

  • appspot.com.
  • " "
  • API- ( )
  • remote_api_stub.ConfigureRemoteApiFromServer - , , ConfigureRemoteApiForOAuth .

, .

, .

. , : https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/google-cloud-insiders/ohnp1XAOdiM/KrQF8_DAAAAJ

+6

, api (bulkloader.py, remote_api_shell.py ..), 401, cookie .

:

rm ~/.appcfg* gcloud auth login

, , Google, (, ).

+3

Source: https://habr.com/ru/post/1656483/


All Articles