2

I've got a web forms application that i need to integrate Facebook, google and twitter log in but what I've found with all the tutorials is that my solution does not have Startup.auth.cs, and then when i implement a Owin class and try to call

app.UseCookieAuthentication

i get the error that owin.iappbuilder doesn't contain the definition.

I am using a 4.5 .net framework and do not have MVC so any help would be great.

I have been stuck on this error for quite some time so getting past this with help or a direction to a tutorial will be a great relief

1 Answer 1

1

See here for a tutorial on how to do this. You want this part:

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

[assembly: OwinStartup(typeof(WebFormsIdentity.Startup))]

namespace WebFormsIdentity
{
   public class Startup
   {
      public void Configuration(IAppBuilder app)
      {
         // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
         app.UseCookieAuthentication(new CookieAuthenticationOptions
         {
            AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
            LoginPath = new PathString("/Login")
         });
      }
   }
}
Sign up to request clarification or add additional context in comments.

3 Comments

How do you authenticate through facebook using this method? because when i include app.UseFacebookAuthentication( i get an error saying it does not exist
You need to add the Owin.Facebook package and add (please note this comes from memory and might not be exact) using Microsoft.AspNet.Owin.Facebook
Worked a charm, Thank you :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.