0

Ich versuche, meine Google Cloud Endpoints API zu verbinden, die als appengine App ausgeführt wird:Google Cloud Endpoints: Authentifizierungsprobleme (Fehler 403)

@endpoints.api(name='helloworldendpoints', allowed_client_ids=["1234", "12345"], version='v1', auth_level=endpoints.AUTH_LEVEL.REQUIRED) 
class HelloWorldApi(remote.Service): 
... 

Die API-Anforderung wie folgt:

scopes = ["https://www.googleapis.com/auth/userinfo.email"] 
credentials = ServiceAccountCredentials.from_json_keyfile_name("CloudEndpointsClient.json", scopes) 

from httplib2 import Http 
http_auth = credentials.authorize(Http()) 

from apiclient.discovery import build 

api_root = 'https://myapp.appspot.com/_ah/api' 
api = 'helloworldendpoints' 
version = 'v1' 
discovery_url = '%s/discovery/v1/apis/%s/%s/rest' % (api_root, api, version) 
service = build(api, version, discoveryServiceUrl=discovery_url) 


response = service.myFunction(myparameter = "123456").execute(http=http_auth)# 
print response 

Die Anforderungen funktionieren gut, wenn ich die Authentifizierungsanforderungen entferne. Ich weiß, dass die Authentifizierung funktioniert, da sich der Fehler nach der Authentifizierung ändert.

Die Fehlermeldung Ich erhalte ist:

googleapiclient.errors.HttpError: https://my-app.appspot.com/_ah/api/helloworldendpoints/v1/obtainScoreFromEmail?myparameter=1234&alt=json returned "Access Not Configured. has not been used in project 123456789 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/helloworldendpoints/overview?project=123456789 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.">

ich nicht die API in meinem Google Cloud-Projekt aktivieren können, da die API nicht existiert.

+0

Wenn Sie wissen, dass das Projekt nicht existiert, warum erstellen Sie keins? – Rajat

+0

Das Projekt existiert. Was nicht vorhanden ist, ist der zu aktivierende API-Dienst. – Luka

+0

Ok, also können Sie in der "Google Console> Library" die API aktivieren, die Sie verwenden möchten. Welche spezielle API können Sie nicht finden? – Rajat

Antwort

Verwandte Themen