Failing To Authorize Connection To Own GAE Endpoints API With Service Account
Solution 1:
Thank you for the help. There are a couple things I did wrong above.
Firstly, I needed to reference the app engine project id in the allowed ids list.
API_ID = 'project-id-number.apps.googleusercontent.com'
@endpoints.method(message_types.VoidMessage, StatusCollection,
allowed_client_ids=[API_ID, SERVICE_ACCOUNT_ID,
endpoints.API_EXPLORER_CLIENT_ID],
audiences=[ANDROID_AUDIENCE],
scopes=[endpoints.EMAIL_SCOPE],
path='status', http_method='GET',
name='statuses.listStatus')
I had incorrectly come to the assumption that the build() method would only work with official google APIS, but it turned out I was referencing my project incorrectly. With the project id in place, I could use build() instead of writing my own httplib2 call in the server side file (which didn't work).
Erasing the code beneath 'http = credentials.authorize(http)' I replaced it with the following:
myservice = build('my-service', 'v1', http=http, discoveryServiceUrl=discoveryServiceUrl)
data = myservice.my-path().endpoint-name()
results = data.execute()
This successfully authorizes my account and calls the endpoint. Woot! If anyone else has questions about this, or if my solution isn't clear, please feel free to comment. This was a painful process I don't wish upon anyone else.
Post a Comment for "Failing To Authorize Connection To Own GAE Endpoints API With Service Account"