Socket
Socket
Sign inDemoInstall

tbdevkit-ngauth

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tbdevkit-ngauth

## How to use


Version published
Maintainers
1
Created
Source

Tbdevkit-ngauth v 0.0.3

How to use

Install package

npm install tbdevkit-ngauth --save-dev

Import module in app module, with custom configuration:

const APP_AUTH_CONFIG: AuthConfig = {
  loginApiEndpoint: '/api/login',
  userApiEndpoint: '/api/user',
  rolesApiEndpoint: '/api/userroles',
  permissionsApiEndpoint: '/api/userpermissions',
};

@NgModule({
  declarations: [
    AppComponent,
    LoginComponent,
    DashboardComponent
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    RouterModule.forRoot(routes),
    FormsModule,
    ReactiveFormsModule,
    TbdevkitAuthModule.forRoot(APP_AUTH_CONFIG)
  ],
  providers: [AuthGuardService],
  bootstrap: [AppComponent]
})
export class AppModule {
}

Inside your login component use login method as the following:

login(): void {
    if (this.form.valid) {
      const loginData = this.form.getRawValue();
      this.authService.login(loginData.username, loginData.password).subscribe(() => {
        this.router.navigate(['/dashboard']);
      });
    }
  }

Token is automatically refreshed on secure endpoint calls.

FAQs

Package last updated on 22 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc