0

Please help .i am new to cloud endpoint and not able to authenticate my nodejs api using cloud endpoint and api key .

My nodejs api:https://iosapi-dot-ingka-rrm-ugc-dev.appspot.com is working perfectly .However it's not working after authenticate with cloud endpoint and Api key.

For fetching data(get), i am using routing in my api like :

https://iosapi-dot-ingka-rrm-ugc-dev.appspot.com/ugc/iosreviewratings/20200611 : 20200611 : is any date range i have to pass . https://iosapi-dot-ingka-rrm-ugc-dev.appspot.com/ugc/iosreviewratings/20200611?Limit=2&Offset=1

after endpoint deployment ., whenever i am acessing my api with api key , i am getting error " "message": "Method doesn't allow unregistered callers (callers without established identity). Please use API Key or other form of API consumer identity to call this API.", "

My Cloud endpoint has been deployed successfully .The below are my openapi.yaml .(ingka-rrm-ugc-dev : is my project id)

openapi.yaml

swagger: "2.0"
info:
  description: "A simple Google Cloud Endpoints API example."
  title: "Endpoints Example"
  version: "1.0.0"
host: "ingka-rrm-ugc-dev.appspot.com"
consumes:
- "application/json"
produces:
- "application/json"
schemes:
- "https"
paths:
  "/ugc/iosreviewratings/*":
    get:
      produces:
        - application/json
      operationId: "auth_info_google_jwt"
      parameters:
        - name: Limit
          in: query
          required: false
          type: string
          x-example: '200'
        - name: Offset
          in: query
          required: false
          type: string
          x-example: '2'
      responses:
        '200':
          description: Definition generated from Swagger Inspector
# This section requires all requests to any path to require an API key.
security:
- api_key: []
securityDefinitions:
  # This section configures basic authentication with an API key.
  api_key:
    type: "apiKey"
    name: "key"
    in: "query"

app.yaml ========--

runtime: nodejs
env: flex
service: iosapi

# This sample incurs costs to run on the App Engine flexible environment.
# The settings below are to reduce costs during testing and are not appropriate
# for production use. For more information, see:
# https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml

manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

# [START configuration]
endpoints_api_service:
  # The following values are to be replaced by information from the output of
  # 'gcloud endpoints services deploy openapi-appengine.yaml' command.
  name: ingka-rrm-ugc-dev.appspot.com
  rollout_strategy: managed
# [END configuration]

Please help me finding where is issue exactly and why api is not working with end point and api key

already enabled all service for for endpoint

gcloud services enable servicemanagement.googleapis.com
gcloud services enable servicecontrol.googleapis.com
gcloud services enable endpoints.googleapis.com

gcloud services enable ingka-rrm-ugc-dev.appspot.com

.

  • Are you sending api key in a query? Also check [this](https://swagger.io/docs/specification/describing-parameters/#path-parameters) on path parameters. – Emil Gi Jun 22 '20 at 08:27
  • You seem to have included your Google Cloud project ID in the question. If you would like to have it removed, please [edit] your question to submit a sanitized version, and then flag for moderator attention to have the revision history purged. – Cody Gray - on strike Jul 26 '20 at 10:05

0 Answers0