Marvin Ericson:
I use an API to get windows user name with User.Identity.Name.
in browser it is working, but when I call it from Angular 4 project it returns error 401 unauthorized.
any ideas please?
EDIT
Here the code below:
getWinUser(): Observable
{
const headers1 = new Headers({'Content-Type': 'application/json'});
const options1 = new RequestOptions({ headers: headers1, withCredentials: true });
return this.http.get('http://seserv112/winauth/api/winuser', options1)
.map(sub => sub.toString());
}
showWinUser(): string {
this.getWinUser().subscribe( response => {
this.user = response;
// console.log('resp :' + this.resp);
console.log('user is : ' + this.user)
});
return this.user;
}
Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE