Hello, how can I made this code with asp.net core 2 under Visual studio 2017.
app.UseFacebookAuthentication(new FacebookAuthenticationOptions
{
AppId = "**************",
AppSecret = "************",
Scope = { "email", "manage_pages", "pages_show_list", "user_likes", "user_events", "user_videos", "user_photos", "user_status", "publish_pages" },
Fields = { "birthday", //User's DOB
"picture", //User Profile Image
"name", //User Full Name
"email", //User Email
"gender", //user's Gender
},
Provider = new PopupFacebookProvider
{
OnAuthenticated = context =>
{
context.Identity.AddClaim(new System.Security.Claims.Claim("FacebookAccessToken", context.AccessToken));
return Task.FromResult(true);
}
}
});
the PopupFacebookProvider is a class. Thanks.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Owin.Security.Facebook;
namespace ChartListOfObject.Models
{
public class PopupFacebookProvider : FacebookAuthenticationProvider
{
public override void ApplyRedirect(FacebookApplyRedirectContext context)
{
context.Response.Redirect(context.RedirectUri + "&display=popup");
}
}
}
Want to convert just the first code Because I think the the second code is the same in vs2015 and vs 2017.
thanks.
You need to configure OAuth login in .NET Core, it is not related to Visual Studio version but with the difference in coding in .NET Core and MVC
https://www.blinkingcaret.com/2017/05/24/facebook-login-asp-net-core/
Read the above link to configure Login using OAuth in .NET Core, you may have to change lots of things in order to convert your app into .NET Core.
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly