1
votes

We are building ASP.NET MVC core web app and accessing data through ASP.NET Core Web API.

We have to give authentication and authorization to both MVC Core and Web API Core side.

If user is authenticated in MVC core web app then while accessing the data on web API core it is should not again authenticate. If user is directly accessing the web API then it should not allow and ask for authentication.

We also want to give authentication through Google.

1

1 Answers

0
votes

For WebAPI I suggest token based authentication, Google support OAuth. I suggest you take a look at the following link:

https://stormpath.com/blog/token-authentication-asp-net-core

There are some community-led efforts to build rich token authentication functionality for ASP.NET Core:

AspNet.Security.OpenIdConnect.Server – Similar to the OAuth Authorization Server middleware for ASP.NET 4.x.

OpenIddict – Wraps OpenIdConnect.Server up into an easier-to-use package that plugs into ASP.NET Identity.

IdentityServer4 – A port of Thinktecture IdentityServer3 to .NET Core.

All of them have sample MVC and API apps. Enjoy.