0

我是 API Gateway 的新手,我将 Strapi CMS 部署为云 RUN 中的容器,并通过 API 网关中的 swagger 访问 Strapi API。云运行服务对所有用户都有 Allow Unathenticated 权限。但是当我尝试点击 API Gateway URL 时,它给了我

{"statusCode":401,"error":"Unauthorized","message":"Invalid token."}

以下是我在 API 网关中发布的招摇。非常感谢您的支持。

swagger: '2.0'
info:
  version: '1.0'
  title: CMS Service
  description: CMS API Service
  contact: {}
host: www.example.com
basePath: /
securityDefinitions: {}
schemes:
  - https
consumes:
  - application/json
produces:
  - application/json
x-google-backend:
  address: https://CLOUD_RUN_URL
paths:
  "/weblogin":
    get:
      description: Find all the weblogin's records
      summary: Weblogin_GET
      tags:
        - Weblogin
      operationId: Weblogin_GET
      deprecated: false
      produces:
        - application/json
      parameters:
        - name: _limit
          in: query
          required: false
          type: integer
          format: int32
          description: Maximum number of results possible
        - name: _sort
          in: query
          required: false
          type: string
          description: Sort according to a specific field.
        - name: _start
          in: query
          required: false
          type: integer
          format: int32
          description: Skip a specific number of entries (especially useful for pagination)
        - name: '='
          in: query
          required: false
          type: string
          description: Get entries that matches exactly your input
        - name: _ne
          in: query
          required: false
          type: string
          description: Get records that are not equals to something
        - name: _lt
          in: query
          required: false
          type: string
          description: Get record that are lower than a value
        - name: _lte
          in: query
          required: false
          type: string
          description: Get records that are lower than or equal to a value
        - name: _gt
          in: query
          required: false
          type: string
          description: Get records that are greater than a value
        - name: _gte
          in: query
          required: false
          type: string
          description: Get records that are greater than  or equal a value
        - name: _contains
          in: query
          required: false
          type: string
          description: Get records that contains a value
        - name: _containss
          in: query
          required: false
          type: string
          description: Get records that contains (case sensitive) a value
        - name: _in
          in: query
          required: false
          type: array
          items:
            type: string
          description: Get records that matches any value in the array of values
        - name: _nin
          in: query
          required: false
          type: array
          items:
            type: string
          description: Get records that doesn't match any value in the array of values
      responses:
        '200':
          description: Retrieve weblogin document(s)
          schema:
            type: array
            items:
              $ref: '#/definitions/Weblogin'
          headers: {}
        '403':
          description: Forbidden
          schema:
            $ref: '#/definitions/Error'
          headers: {}
        '404':
          description: Not found
          schema:
            $ref: '#/definitions/Error'
          headers: {}
        default:
          description: unexpected error
          schema:
            $ref: '#/definitions/Error'
          headers: {}
    put:
      description: Update a single weblogin record
      summary: Weblogin_PUT
      tags:
        - Weblogin
      operationId: Weblogin_PUT
      deprecated: false
      produces:
        - application/json
      consumes:
        - application/json
      parameters:
        - name: body
          in: body
          required: true
          description: ''
          schema:
            $ref: '#/definitions/NewWeblogin'
      responses:
        '200':
          description: Retrieve weblogin document(s)
          schema:
            $ref: '#/definitions/Weblogin'
          headers: {}
        '403':
          description: Forbidden
          schema:
            $ref: '#/definitions/Error'
          headers: {}
        '404':
          description: Not found
          schema:
            $ref: '#/definitions/Error'
          headers: {}
        default:
          description: unexpected error
          schema:
            $ref: '#/definitions/Error'
          headers: {}
    delete:
      description: Delete a single weblogin record
      summary: Weblogin_DELETE
      tags:
        - Weblogin
      operationId: Weblogin_DELETE
      deprecated: false
      produces:
        - application/json
      parameters: []
      responses:
        '200':
          description: deletes a single weblogin based on the ID supplied
          schema:
            type: integer
            format: int64
          headers: {}
        '403':
          description: Forbidden
          schema:
            $ref: '#/definitions/Error'
          headers: {}
        '404':
          description: Not found
          schema:
            $ref: '#/definitions/Error'
          headers: {}
        default:
          description: unexpected error
          schema:
            $ref: '#/definitions/Error'
          headers: {}
definitions:
  Weblogin:
    title: Weblogin
    type: object
    properties:
      id:
        type: string
      emaillabel:
        type: string
      passwordlabel:
        type: string
      remembermelabel:
        type: string
      forgotpasswordlabel:
        type: string
      noaccountlabel:
        type: string
      localizations:
        type: array
        items:
          $ref: '#/definitions/Localization4'
      locale:
        type: string
      published_at:
        type: string
        format: date-time
    required:
      - id
  NewWeblogin:
    title: NewWeblogin
    type: object
    properties:
      emaillabel:
        type: string
      passwordlabel:
        type: string
      remembermelabel:
        type: string
      forgotpasswordlabel:
        type: string
      noaccountlabel:
        type: string
      localizations:
        type: array
        items:
          type: string
      locale:
        type: string
      published_at:
        type: string
        format: date-time
      created_by:
        type: string
      updated_by:
        type: string
  Error:
    title: Error
    type: object
    properties:
      code:
        type: integer
        format: int32
      message:
        type: string
    required:
      - code
      - message
  Localization4:
    title: Localization4
    type: object
    properties:
      id:
        type: string
      emaillabel:
        type: string
      passwordlabel:
        type: string
      remembermelabel:
        type: string
      forgotpasswordlabel:
        type: string
      noaccountlabel:
        type: string
      localizations:
        type: array
        items:
          type: string
      locale:
        type: string
      published_at:
        type: string
      created_by:
        type: string
      updated_by:
        type: string
    required:
      - id
tags:
  - name: Consumerregister
  - name: Mmlanding
  - name: Mmlogin
  - name: Serviceproviderregister
  - name: Weblogin
  - name: Email - Email
  - name: Upload - File
  - name: UsersPermissions - Role
  - name: UsersPermissions - User
externalDocs:
  url: 'https://strapi.io/documentation/developer-docs/latest/getting-started/introduction.html'
  description: Find out more
4

0 回答 0