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
  • #6086
Closed
Open
Issue created Apr 28, 2020 by Administrator@rootContributor

[REQ] TypeScript Angular README.md add example with authentication service

Created by: dennisameling

Is your feature request related to a problem? Please describe.

Many Angular applications will have an authentication service that manages the API access tokens. Consider the following example, where the ApiModule's forRoot() method is used to set the API configuration (basePath, accessToken, etc.) for the application:

// configuring providers
import { ApiModule, Configuration, ConfigurationParameters } from 'YOUR_API';

export function apiConfigFactory (): Configuration => {
  const params: ConfigurationParameters = {
    // set configuration parameters here.
  }
  return new Configuration(params);
}

@NgModule({
    imports: [ ApiModule.forRoot(apiConfigFactory) ],
    declarations: [ AppComponent ],
    providers: [],
    bootstrap: [ AppComponent ]
})
export class AppModule {}

However, in this example, it's not possible to access the AuthService already in Angular's AppModule and update the accessToken as soon as the AuthService updates it. Similar to what is mentioned in https://github.com/swagger-api/swagger-codegen/issues/5996#issue-240845000.

Describe the solution you'd like

We should add an example based on kewur's answer to the README.md of generated API libraries for Angular/TypeScript.

Describe alternatives you've considered

n/a

Additional context

I have a PR ready that adds this example to README.md, will link it to this issue.

Assignee
Assign to
Time tracking