I'm using Angular for my website. Initially once the page is launched, there are no issues and it authenticates perfectly. However, when refreshing the page it can't pull the currently login user anymore. It looks like it doesn't call windows authentication. I'm adding my code. Any help is appreciated.
intercept(req: HttpRequest<any>, next: HttpHandler):
Observable<HttpEvent<any>> {
console.log('AppInterceptorService1111');
req = req.clone({
withCredentials: true
});
return next.handle(req)
.pipe(catchError(this.handleError));
}
The local storage has already been implemented.
this.authenticateCurrentNTLogin().subscribe((data: any) => {
this.currentUserInfoService.tokenInfo = data.Response;
localStorage.setItem('userToken', this.currentUserInfoService.tokenInfo.access_token);
localStorage.setItem('userRoles', this.currentUserInfoService.tokenInfo.role);
this.currentUserInfoService.currentUserTokenExpiration = new Date();
this.currentUserInfoService.currentUserTokenExpiration.setSeconds(new Date().getSeconds() + parseInt(this.currentUserInfoService.tokenInfo.expires_in));
localStorage.setItem('myTokenExpiration', this.currentUserInfoService.currentUserTokenExpiration.toLocaleDateString() +
' ' + this.currentUserInfoService.currentUserTokenExpiration.toLocaleTimeString());
},