Skip to content

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

@johnkoerner

Description

@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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions