0

Below is my api yaml.

swagger: "2.0"
info:
  title: sample
  description: API to read validated details
  version: 1.0.0
produces:
  - application/json
x-google-management:
  metrics:
    # Define a metric for read requests.
    - name: "requests"
      displayName: "API key requests"
      valueType: INT64
      metricKind: DELTA
  quota:
    limits:
      # Define the limit or the read-requests metric.
      - name: "requests-limit"
        metric: "requests"
        unit: "1/min/{project}"
        values:
          STANDARD: 2
paths:
  /generator:
    post:
      x-google-backend:
        address: dummy
        jwt_audience: dummy
      responses:
        "200":
          schema:
            $ref: '#/definitions/UserDetails'
          description: Successful response
      description: Returns details .
      operationId: dummy
      summary: Get details 
      x-google-quota:
        metricCosts:
          "requests": 1  
securityDefinitions:
  firebase:
    flow: implicit
    authorizationUrl: ''
    scopes: {}
    type: oauth2
    x-google-issuer: “xyz”
    x-google-jwks_uri: “per”
    x-google-audiences: "abc”

Function is getting called but it's not reporting any error on calling function multiple time within a minute.

Am i missing something ? I am following : https://medium.com/google-cloud/rate-limit-your-api-usage-with-cloud-endpoints-quotas-1270da55d2bf https://cloud.google.com/endpoints/docs/openapi/quotas-configure

Could you suggest if rate limit is possible with api gateway having firebase auth ?

Djai
  • 188
  • 10
  • 1
    Rate limit and API gateway only works with API Key. Keep in mind that API Key is not an authentication mode. You can keep your firebase auth but requires the client to add an API Key. Problem: you must have 1 API Key per client. Maybe the easiest is to use a HTTPS load balancer and to set a rate limit directly on it (based on IP, cookies,...) and skip API Gateway (or use API Gateway only for the firebase auth) – guillaume blaquiere Feb 22 '23 at 09:18

0 Answers0