1. SPEAK 3

Logout from Sitecore

Version:

You use the logout service in your Angular application to log out from Sitecore. You use it as in this example:

Import the logout module in app.module.ts:

import { SciLogoutModule } from '@speak/ng-sc/logout';
// ...
imports: [
  SciLogoutModule
],
// ...

Inject and use the logout service in a component like this:

import { SciLogoutService } from '@speak/ng-sc/logout';
@Component({
  selector: 'app-logout-example',
  template: `
    <button (click)="logout()">Logout</button>
  `
})
export class LogoutExampleComponent {
  constructor(
    private logoutService: SciLogoutService
  ) { }
  logout(): void {
    this.logoutService.logout();
  }
}
If you have suggestions for improving this article, let us know!