Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: Unauthorized request with Angular 4

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


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: Unauthorized request with Angular 4

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×