diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 56e4a381..14639c58 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -100,12 +100,14 @@ export class AppModule const config: OpenIdConfiguration = { stsServer: configResult.customConfig.stsServer, redirect_url: "/", + post_logout_redirect_uri: "/logout", client_id: 'kyoo.webapp', response_type: "code", scope: "openid profile kyoo.read offline_access", silent_renew: true, silent_renew_url: "/silent", use_refresh_token: true, + start_checksession: true, forbidden_route: '/Forbidden', unauthorized_route: '/Unauthorized', diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index 91c79738..1a2a1888 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -1,5 +1,6 @@ import { Injectable } from '@angular/core'; import {OidcSecurityService} from "angular-auth-oidc-client"; +import {HttpClient} from "@angular/common/http"; @Injectable({ providedIn: 'root' @@ -9,7 +10,7 @@ export class AuthService isAuthenticated: boolean; user: any; - constructor(public oidcSecurityService: OidcSecurityService) + constructor(public oidcSecurityService: OidcSecurityService, private http: HttpClient) { if (this.oidcSecurityService.moduleSetup) this.authorizeCallback(); @@ -37,7 +38,10 @@ export class AuthService logout() { - this.oidcSecurityService.logoff(); + this.http.get("api/account/logout").subscribe(() => + { + this.oidcSecurityService.logoff(); + }); } private authorizeCallback()