Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddCors(options =>
- {
- options.AddPolicy("CorsPolicy",
- builder => builder
- .AllowAnyOrigin()
- .AllowAnyMethod()
- .AllowAnyHeader()
- .AllowCredentials()
- );
- });
- .....
- public void Configure(IApplicationBuilder app, IHostingEnvironment env)
- {
- app.UseCors(policyName: "CorsPolicy");
- ....
- [Route("api/[controller]")]
- [EnableCors("CorsPolicy")]
- public class ManageUsersController : Controller
- { ...
- loginByPortal(credentials: Credentials): Observable<userLoginViewmodel> {
- const headers = new HttpHeaders({ 'Content-Type': 'application/json' });
- return this.http
- .post(`${this.appConfig.apiEndpoint}/Account/LoginByPortal`, credentials,
- { headers: headers, withCredentials: true /* For CORS */ })
- .map(response => response || {})
- .catch((error: HttpErrorResponse) => Observable.throw(error));
- }
Add Comment
Please, Sign In to add comment