Logout from Sitecore

Current version: 9.0

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:

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

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

RequestResponse
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();
  }
}

Do you have some feedback for us?

If you have suggestions for improving this article,