loopback-connector-swagger icon indicating copy to clipboard operation
loopback-connector-swagger copied to clipboard

It only works if I send the token in the query string

Open ffflabs opened this issue 8 years ago • 2 comments

Bug or feature request

  • [x] Bug
  • [ ] Feature request

Description of feature (or steps to reproduce if bug)

  1. I declare a Swagger datasource in datasources.json. (it's another loopback app)
  "SwaggerDS": {
    "name": "SwaggerDS",
    "connector": "swagger",
    "spec": "https://myapi.domain.com/explorer/swagger.json",
    "security": {
      "type": "oauth2",
      "name": "Authorization",
      "accessToken": "bj4iI9q9uv9p5n0JVk1AUDOzFN1RZiOHj5JixJIK2DmLlwy1FEO9LLNe4957mYlX"
    }
  }
  1. I set a listener for the connected event in the boot folder
  2. The datasource connects
  3. I create a model, which contains every method of every model in the referenced loopback app
  4. I try to execute any method and it returns 404 error. (except for the User_login method)
  5. If I define the connector as:
  "SwaggerDS": {
    "name": "SwaggerDS",
    "connector": "swagger",
    "spec": "https://myapi.domain.com/explorer/swagger.json",
    "security": {
      "type": "oauth2",
      "name": "access_token",
      "accessToken": "bj4iI9q9uv9p5n0JVk1AUDOzFN1RZiOHj5JixJIK2DmLlwy1FEO9LLNe4957mYlX",
      "in" : "body"
    }
  }

Everything works.

Link to sample repo to reproduce issue (if bug)

N/A

Expected result

It should work either sending the token in the query string or in the header

Actual result (if bug)

It only works when sending the token in the query string

Additional information (Node.js version, LoopBack version, etc)

  • node v8.11.3
  • loopback v3.22
  • loopback-connector-swagger: 3.2.0

ffflabs avatar Oct 28 '18 17:10 ffflabs

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 17 '19 17:09 stale[bot]

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

stale[bot] avatar Oct 01 '19 18:10 stale[bot]