我想将 Authentication with GitHub 添加到我的 Asp Net Core 6 项目中,但我在 Internet 上找到的所有内容都是针对旧版本的 Asp Net。如何添加?
我将 Microsoft.AspNetCore.Authentication.OAuth
包添加到我的项目中,并创建了一个 Github OAuth 应用程序。我还添加了客户端 ID 和客户端密码
dotnet user-secrets set Github:ClientId <clientid>
dotnet user-secrets set Github:ClientSecret <clientsecret>
我在网上找了教程,但是只有6以下的Asp Net版本的教程。
最佳答案
请使用 AspNet.AspNet.Security.OAuth.GitHub
和 OctoKit
库。您需要在项目路径中运行安装命令。喜欢:
PM> cd .\GithubAuth
PM> Install-Package AspNet.Security.OAuth.GitHub -Version 6.0.5
PM> Install-Package Octokit -Version 0.50.0
我在我的 dotnet core 6 应用程序中进行了测试,它运行良好。
更多详情,请查看以下博客:
本篇博文中提到了Linux平台,可以忽略。
关于c# - 在 Asp Net Core 6 中使用 Github 进行身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71740380/