Home > Back-end >  Authentication with Github in Asp Net Core 6
Authentication with Github in Asp Net Core 6

Time:04-05

I want to add Authentication with GitHub to my Asp Net Core 6 project, but everything I find in the Internet is for older versions of Asp Net. How can I add it?

I added the Microsoft.AspNetCore.Authentication.OAuth package to my project and created an Github OAuth application. I also added the client id and client secret with

dotnet user-secrets set Github:ClientId <clientid>
dotnet user-secrets set Github:ClientSecret <clientsecret>

I searched for tutorials online, but there are only tutorials using a Asp Net Version that is less than 6.

CodePudding user response:

Please use AspNet.AspNet.Security.OAuth.GitHub and OctoKit library. You need run the install command in your project path. Like:

PM> cd .\GithubAuth
PM> Install-Package AspNet.Security.OAuth.GitHub -Version 6.0.5
PM> Install-Package Octokit -Version 0.50.0

I have test in my dotnet core 6 app, and it works fine.

For more details, please check below blogs:

In this blogs, it mentions Linux platform, you can ignore it.

Add GitHub OpenID Auth For ASP.NET Core Apps

  • Related