We are creating a project using Aurelia/Typescript. For those who don't know what that is, it's basically a better AngularJS (opinionated). Our project runs perfect, except for the fact that we need to incorporate windows authentication now, which we can get via ASP.NET Core. This is a bit of a problem. Considering that we are using Typescript, which gets compiled for us into javascript, how can we access our windows auth user from Aurelia/Client-side? Reason being that we are calling API's from the client-side using Aurelia and for certain api's, we need to be able to pass in the user authentication. The only solution I've come up with is passing the user thru the URL as a parameter and trying to access it from Aurelia. This does not sound like a good idea, but we've struggled to find another solution. Any ideas?
How to incorporate windows authentication with ASP.NET Core & AureliaJS project
javascript;asp.net mvc;authentication
We are in the similar situation, using ASP.NET Core for server side and Aurelia for the client. We will probably not use Windows authentication, but I was thinking, how I could do that.On the server side we have single MVC controller and View (Index.cshtml) to host the Aurelia SPA. So the idea was to authenticate the user on the server and render the user information into the Index.cshtml as a global JavaScript variable. This should be easily accessible from your TypeScript code.Index.cshtml: (ASP.NET MVC)<script type=text/javascript>   // Create global variable to store user info.  var UserInfo = { Login: '@(Model.Login)', Email: '@(Model.Email)'  };</script>Home.ts: (Aurelia)declare var UserInfo: any; // Tell TS the variable is already defined elsewhere.export class Home {  name: string;  email: string;  constructor ()  {    this.name = UserInfo.Login;    this.email = UserInfo.Email;  }}Other idea (I didn't tried it yet) would be to pass the user info in cookies or session storage.This is not recommended if you need to pass sensitive information!