Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have enabled windows authentication in web API. My Frontend application is developed by Angular 6. When I call API, its showing unauthorized issue in the console. But no popup comes for the credential.

Please help. How to configure in angular so that credential popup will come.

What I have tried:

get(commandID, moduleID, data) {
    const actionURL = AppUrlConfig.getUrl(commandID);
    return this.http.get(environment.baseApi + actionURL.url, 
     this.comServ.GetHeaderValue())

  }
Posted
Updated 23-Nov-18 1:25am

1 solution

When you call the web api, you have to pass { withCredentials: true}. So that popup will come for credential
get(commandID, moduleID, data) {
    const actionURL = AppUrlConfig.getUrl(commandID);
    return this.http.get(environment.baseApi + actionURL.url, 
     { withCredentials: true})
    .pipe(catchError((error: Response) =>{      
      this.router.navigate(['/errorpage']);
      return throwError(error);       
    }));

  }
 
Share this answer
 
Comments
Member 14064716 23-Nov-18 7:32am    
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900