Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dennisameling opened this issue Apr 28, 2020 · 0 comments · Fixed by #6087
Closed

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

dennisameling opened this issue Apr 28, 2020 · 0 comments · Fixed by #6087

Comments

@dennisameling
Copy link
Contributor

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 swagger-api/swagger-codegen#5996 (comment).

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant