Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #1133
Closed
Open
Issue created Sep 27, 2018 by Administrator@rootContributor

[javascript, typescript-node] HTTP / Bearer Scheme does not generate clients that use Bearer Tokens

Created by: johnkoerner

Description

Setting up an API that uses a bearer token should result in clients that send the Bearer XXXX value in the Authorization header. However the javascript and typescript-node clients generate code that wants to send a username/password combination in the header.

openapi-generator version

3.2.3

OpenAPI declaration file content or url
components:
  securitySchemes:
    bearerAuth:            # arbitrary name for the security scheme
      type: http
      scheme: bearer
      bearerFormat: JWT  

Full sample: https://gist.github.com/johnkoerner/952becd82bbb238b51907791d0a13d32

Command line used for generation
openapi-generator generate -i Test.yaml -g typescript-node -o ./ts
Steps to reproduce

Generate a typescript-node or javascript client that uses authentication with the bearer scheme.

Suggest a fix/enhancement

When the bearer scheme is specified, then the Authorization header should be specified with the Bearer {accessToken} format. It appears that the OAuth2 flow already supports the Bearer token format.

Note: I only tested with javascript and typescript-node other client generators may have similar issues.

Assignee
Assign to
Time tracking