سؤال

I"m following along with this tutorial:

http://www.asp.net/mvc/tutorials/mvc-5/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-on

I'm attempting to log-in using Facebook. I copied this code almost verbatim:

using Microsoft.AspNet.Identity;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.Forms;
using Owin;

namespace WineNight
{
    public partial class Startup
    {
        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            // Enable the application to use a cookie to store information for the signed in user
            // and to use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseSignInCookies();

            app.UseFacebookAuthentication(
               appId: "000000000000000",
               appSecret: "000000000000000");

            app.UseGoogleAuthentication();
        }
    }
}

I'm getting an error when I call UseSignInCookies:

Owin.IAppBuilder does not contain a definition for UseSignInCookies and no extension method UseSignInCookies accepting a first argument of type Owin.IAppBuilder could be found (are you missing a using directive or an assembly reference?)

C:\users\chris\documents\visual studio 2013\Projects\WineNight\WineNight\App_Start\Startup.Auth.cs

I installed the beta package for Microsoft.Owin.Security.Forms, but I'm still getting this error. Where does this extension method reside?

هل كانت مفيدة؟

المحلول

You're looking for the app.UseExternalSignInCookie() extension method.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top