【问题标题】:ASP.NET 5 Template web application external authenicationASP.NET 5 模板 Web 应用程序外部身份验证
【发布时间】:2016-06-01 13:31:07
【问题描述】:

我确信在这个过程中我缺少一些小东西,但我观看的所有视频似乎都有与我不同的设置,这导致我的应用程序出现问题。我使用的是 Visual Studio 2015 Community Edition,我的设置过程如下;

归档新项目 使用.net framework 4.6 ASP.NET 5 Web 应用,个人授权

创建了那个项目,然后打开了 startup.cs 文件,它告诉我去http://go.microsoft.com/fwlink/?LinkID=532715添加外部身份验证

这个网站告诉我创建 facebook 应用程序,我已经完成了。但是,标题为“使用 SecretManager 存储 Facebook AppId 和 AppSecret”的下一步我迷路了。我做了安装 Secret Manager 的第一步,但之后我又迷路了。谁能帮我获得外部授权。

另外值得注意的是,在我观看的所有视频中,他们的解决方案浏览器看起来与我的不一样。

我的看起来像这样 Link to picture

在视频中,解决方案资源管理器看起来更像一棵普通的树

感谢您提供任何可能的答案,并感谢您花时间在可能的情况下创建一个小型指南。

【问题讨论】:

    标签: visual-studio-2015 asp.net-core facebook-authentication


    【解决方案1】:

    您可以将您的 Facebook AppIdAppSecret 存储在 appsettings.json 中 在 appsettings.json 文件中添加此字符串。用您的 AppIdAppSecret 号码替换 XXXX。

    "Authentication": {
        "Facebook": {
          "AppId": "XXXXXXXXXXXXXX",
          "AppSecret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    }
    

    在 Startup.cs 中的方法 public void Configure(..) {..} 中使用它,如下所示:

    app.UseFacebookAuthentication(new FacebookOptions()
    {
       AppId = Configuration["Authentication:Facebook:AppId"],
       AppSecret = Configuration["Authentication:Facebook:AppSecret"]
    });
    

    【讨论】:

      猜你喜欢
      • 2017-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-25
      • 2016-10-01
      • 1970-01-01
      • 2013-11-22
      相关资源
      最近更新 更多