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
  • #6944
Closed
Open
Issue created Jul 15, 2020 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][typescript-angular] Unable to use multiple access tokens

Created by: djnalluri

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

All security schemes that use the HTTP Bearer and OAuth2 schemes rely on the single accessToken field of the configuration object. Using API's that use multiple of this scheme become tricky to use as you must swap out the access token to the correct one prior to each request.

openapi-generator version

<= 5.0.0-beta

OpenAPI declaration file content or url

https://gist.github.com/djnalluri/1a6ae2ad99f8f198620cb262432d4615

Command line used for generation

openapi-generator generate -g typescript-angular -i openapi.yml

Steps to reproduce

Use the spec file and command provided above to generate a client.

Related issues/PRs

None for typescript-angular

Suggest a fix

I suggest unifying the configuration for API Key, Basic, Bearer, and OAuth2 schemes into a single map for lookup just like the apiKeys property currently in the configuration object. The type of the map can be adjusted to also accept functions returning strings like accessToken currently does; OAuth2 scheme behaviour can be kept mostly the same in this way. Basic authentication can be adjusted to first check for an already prepared base64 string in the map and fall back to existing behaviour.

Assignee
Assign to
Time tracking