Reputation: 819
Is it possible to use Microsoft.AspNetCore.Identities
in a SPA project with react.js? The template in Visual Studio 2017 only offers a No Authentication option. If you can not use Microsoft.AspNetCore.Identity
, what other options are there? Thanks.
Upvotes: 1
Views: 625
Reputation: 819
IdentityServer4 with AspNetCore.Identities is solution for SPA applications.
Upvotes: 0
Reputation: 1
Use ReactJs.Net - https://reactjs.net.
[Authorize]
public async Task<IActionResult> Index()
{
var result = await drw.GetAllCompanysAsync();
return View(result);
}
in view
@model IEnumerable<Company>
@{
ViewBag.Title = "Абоненты";
}
Html.React("Application", new
{
initialData = Model,
url = Url.Action("GetCompanyHeatPerDay", ,
submitUrl = Url.Action("AddComment"),
}, containerId: "app")
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/react/16.4.1/umd/react.development.js"></script>
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.4.1/umd/react-dom.development.js"></script>
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/prop-types/15.6.2/prop-types.min.js"></script>
<script src="@Url.Content("~/js/app.jsx")"></script>
Html.ReactInitJavaScript()
all view logic in app.jsx
Upvotes: 0