Cause in my backend api there is no logout endpoint. My config for logout is
logout: {
redirect: {
success: '/',
failure: '/',
},
The redirect happens but not remove the token authentication from local storage. I was forced to add manually localStorage.removeItem('auth_app_token'); in @nebular/auth/components/logout/logout.component.js
Is there a config for logout without calling backend api?
Is it causing the failure for not removing local token?
Thanks
Having the same issue. Fails on redirect ReturnUrl
I have the same issue. What should the API return as a response?
Logout doesn't work because redirect is null.
@robertoAg if I put localStorage.removeItem('auth_app_token'); in logout.js which is ok BUT it's not redirect to login page. If I put localStorage.removeItem('auth_app_token'); in login.js and have userMenu = [{ title: 'Profile' }, { title: 'Log out' , link: '/auth/login'}]; in hearder.component.ts page.... it redirect to login page but not execute localStorage.removeItem('auth_app_token') unless you refresh it..how did you resolve this? Thanks!
Same here.
@joeyjin @stat1x What I did to workaround this behaviour was create a logout component extending NbLogoutComponent and inside ngOnInit I delete the localStorage key. After that I redirect to login.
import { Component, OnInit } from '@angular/core';
import { NbLogoutComponent } from '@nebular/auth';
@Component({
selector: 'logout',
templateUrl: './logout.component.html',
styleUrls: ['./logout.component.scss']
})
export class LogoutComponent extends NbLogoutComponent implements OnInit {
ngOnInit(){
localStorage.removeItem('auth_app_token');
this.router.navigateByUrl('/auth/login');
}
}
Most helpful comment
@joeyjin @stat1x What I did to workaround this behaviour was create a logout component extending NbLogoutComponent and inside ngOnInit I delete the localStorage key. After that I redirect to login.