Login using Google OAuth 2.0 with .NetCore - .net-core

I want to allow User to login using Gmail through the OAuth2 process.
I don't use Razor as a client it is the reason why did not use the auth template.
My stack is ReactJs and .Net core 2.2.
I have registered my Project and got Secret KEY & Client ID. Now I want to integrate it my Project but I am unable to find any sample working Project.
Thanks, Michael.

Related

How to login to WebApi from Blazor server side and retrieve and pass the cookie to the app?

I want to build a Blazor Server Side app that calls an ASP NET Core Web API that requires authentication/authorization using the Microsoft AspNetCore Identity. I have gonne so far to login, but couldn't find a way to send the cookie after login and delete it on logout.
I have searched extensively, but only found for OAuth, OpenID, Azure, AD, IdentityServer4, ClientSide etc...
As far as I know, the asp.net core identity contains the login view and login action method, there is no build-in that support web api. If you want to use web api with identity, you should inject the user manager and build the authentication controller by yourself.
More details, I suggest you could refer to this article.
Besides for client side part, I suggest you could try to refer to this blog to know how to authentication with client-side Blazor using WebAPI.
This article provide a complete example to authentication with client-side Blazor using WebAPI and ASP.NET Core Identity and configuring Role-based Authorization with client-side Blazor.
It also contains the github for this example.

Sample for .NET Web API, .NET Identity, external login, and token authentication

Where can I find a complete code sample (the entire project) that includes the following:
.NET Web Api 2
.NET Identity 2.0
External login provider
Token authentication instead of cookies
I have a Web API project working with an external login provider but it uses cookie authentication and does not use .NET Identity. I can't find any complete code examples that include the above four requirements.
The best working example one can find is the series of Mr.Mittal at Codeproject in it one can find Entity Framework, Generic Repository pattern and Unit of Work.
Also all the stuff you explained
.NET Web API 2
.NET Identity 2.0
External login provider
Token authentication instead of cookies
keep up with him you'll get to know how this all works here is the link Enterprise Level Application Architecture with Web APIs using Entity Framework, Generic Repository Pattern and Unit of Work

Integrating Okta with Windows ACS

We implement a web application and host in Azure. Then we want to use the SSO feature which is supported by Microsoft Azure ACS. The Condition to view our Website is that users just need to provide the email address throughout login to IdP. When we implement and configure Web application, we do follow all the instructions on the website as below
http://blog.2mas.xyz/configuring-windows-azure-active-directory-access-control/
For now, we can configure and use Window LiveID, Azure AD to login into our Website.
We have a further requirement that our site should support to login SSO from custom IdP which supports SAML 2.0 such as Okta.
Our current issues: When import the SAML 2.0 XML file to ACS, it does not understand this XML file
Please give us some suggestion to use Azure ACS and okta in this situation?
You might find the following helpful: https://www.okta.com/identity-101/integrating-sso-for-azure-ad

Google+ authentication with asp.net identity 2.0.0

I want to implement the asp.net identity 2.0 with a project that I'm working with. This identity system enables logging in with third party login providers such as Facebook, Twitter, Google etc... However it seems that Google has closed registration to new OpenID 2.0 clients as of May 19, 2014. It's an attempt to force developers to use the new Google+ authentication system.
Any idea if the asp.net identity 2.0 system has been upgraded to use the new Google+ authentication system? Any tips would be appreciated.....
Thank you in advance
Follow the article here on how you could update your app and the Google middleware for the new changes made for Google OAuth.
http://blogs.msdn.com/b/webdev/archive/2014/07/02/changes-to-google-oauth-2-0-and-updates-in-google-middleware-for-3-0-0-rc-release.aspx
This is directly related to the Google middleware and does not affect Identity per say.

Authentication using OAuth in Web API

I'm working on a project using ASP.Net MVC5 which also includes a Web API. The API will be for internal use only. I'm using the OWIN library to provider authentication.
I'm having a difficult time figuring out how to correctly implement authentication through the API. I was planning on using OAuth 2.0 but the problem with OAuth is that the user needs to login through a browser page instead of a native login screen. So I was wondering if it is possible to somehow skip the browser.
I've found this example which creates it's own OAuth Authorization Server. But it doesn't show how to make the login native.
If it's a highly trusted client, then you can use the OAuth2 resource owner password flow. You can look at the VS2013 SPA template and/or read on this post:
http://leastprivilege.com/2013/11/13/embedding-a-simple-usernamepassword-authorization-server-in-web-api-v2/
You could use Thinktecture.IdentityServer v2 as a light-weight security token service.
https://github.com/thinktecture/Thinktecture.IdentityServer.v2
You will need to create a WOPI host, which is basically a software solution that can take advantage of the browser-based Office(office web).
Create a custom WOPI host and configure it to use Office Web Apps Server to provide the browser-based file viewing and editing for Office files.
Nice sample on Microsoft MSDN

Resources