Convert lines of C# code from asp.net mvc 5 under visual studio 2015 to asp.net core2 under visual studio 2017


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.


Asked by:- LuneAgile
0
: 245 At:- 9/13/2018 2:12:33 PM
ASP.NET Code-changes-from-mvc-to-core






2 Answers
profileImage Answered by:- neena

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.

1
At:- 9/13/2018 6:03:26 PM


profileImage Answered by:- LuneAgile

Thanks Neena.

 

0
At:- 9/13/2018 8:15:41 PM





Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use