weixin_39878716
weixin_39878716
2020-12-26 00:51

Error when adding 3rd party OAUTH

I have set up a standard aspnet core RC2 web project and tried to add Facebook authentication. After adding this as per docs


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

project.json : "Microsoft.AspNetCore.Authentication.Facebook": "1.0.0-rc3-21225"

I get the following error:


Severity    Code    Description Project File    Line    Suppression State
Error   CS0121  The call is ambiguous between the following methods or properties: 'Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.UseContentRoot(Microsoft.AspNetCore.Hosting.IWebHostBuilder, string)' and 'Microsoft.AspNetCore.Hosting.HostingAbstractionsWebHostBuilderExtensions.UseContentRoot(Microsoft.AspNetCore.Hosting.IWebHostBuilder, string)

What packgage should I be using?

该提问来源于开源项目:aspnet/Hosting

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39528843 weixin_39528843 4月前

    That error doesn't seem to have anything to do with your added code.

    UseContentRoot moved from Hosting to Hosting.Abstractions a little while ago. It sounds like your packages are out of sync. Make sure you have the same version of each package. If not, clear your caches and try again.

    点赞 评论 复制链接分享
  • weixin_39629780 weixin_39629780 4月前

    I had the same problem, figured out I didn't have same versions of packages: Had "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final", "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final", "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc3-21130"

    instead of "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final", "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final", "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final"

    点赞 评论 复制链接分享
  • weixin_39878716 weixin_39878716 4月前

    Some of the packages are not the same version, but this is how they were set on a vanilla MVC project. When you say the versions must be the same, are you referring to ALL the packages listed under dependencies? Changing all the packages to "1.0.0-rc2-final" causes a compiler errors.

    点赞 评论 复制链接分享
  • weixin_39878716 weixin_39878716 4月前

    Just re-added the package and now rc2-final is coming through for both google and facebook

    点赞 评论 复制链接分享

相关推荐