Implementing loggout

This commit is contained in:
Zoe Roux 2020-03-10 22:28:50 +01:00
parent 0991acac1b
commit ec4978f9de
2 changed files with 8 additions and 2 deletions

View File

@ -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',

View File

@ -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()