Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3983172
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:36:57+00:00 2026-05-20T05:36:57+00:00

originally i was using a .net sdk for facebook found here: http://facebooktoolkit.codeplex.com/ but now,

  • 0

originally i was using a .net sdk for facebook found here:

http://facebooktoolkit.codeplex.com/

but now, i am trying to migrate over to the latest version which is hosted below, and implements many of the new facebook features that have recently :

http://facebooksdk.codeplex.com/

Even though I’ve built a few facebook canvas applications and even integrated our company website to use facebook connect, I still get a bit confused with the nuances and details about facebook authentication/authorization changes. For example, how would I port the below .NET serverside code that I used from our old (v3.0) .NET SDK integration with Facebook over to the new v5.0 .NET SDK?

            string perm = "publish_stream"; //or any permission you want to check
            FBConnectAuthentication auth = new FBConnectAuthentication(Settings.FBConnectAPIKey, Settings.FBConnectAPISecret);
            FBConnectSession fbSession = auth.GetSession();
            string userId = fbSession.UserID;
            var session = new Facebook.Session.ConnectSession(Settings.FBConnectAPIKey, Settings.FBConnectAPISecret);
            var api = new Facebook.Rest.Api(session);
            var usr = SessionInfo.CurrentUserOrUserAccountWithLastEmailAddressEntered;
            Facebook.Schema.Enums.ExtendedPermissions perm
                = (Facebook.Schema.Enums.ExtendedPermissions)Enum.Parse(typeof(Facebook.Schema.Enums.ExtendedPermissions), permission);
            hasPermission = api.Users.HasAppPermission(perm);

since the above code is being executed from our server using the REST apis, when porting over to the new sdk should i not worry about using an OAuth access_token?

on the client side, when an end user views a page of my website things seem to work fine when i do the below javascript calls:

FB.Connect.showPermissionDialog('publish_stream, email, user_checkins', publishToWallPermissionGranted);
function publishToWallPermissionGranted() {
    FB.Connect.streamPublish('some share message', null, null, null, false, null);
}

using the client side code above, i am not storing an access_token or doing anything like that, but how come i am able to successfully authenticate, authorize and publish to a user’s stream?

i would really appreciate anyone that can also give me a more detailed explanation when i should use Oauth to get an access token (ie. if a user is using my canvas application) or when i should simply use my appId to initialize the javascript FB object (ie. FB.init()) when making client side api calls or when i should get an application access token.

thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:36:58+00:00Added an answer on May 20, 2026 at 5:36 am

    after some investigation and trial and error, here is what i used to integrate the latest .net facebook sdk

    var httpContext = new System.Web.HttpContextWrapper(System.Web.HttpContext.Current);
    var auth = new Facebook.Web.Authorizer(Settings.FBAppId, Settings.FBConnectAPISecret, (System.Web.HttpContextBase) httpContext);
    Facebook.FacebookClient fbApp = null;
    if (auth.Session != null && auth.Session.AccessToken != null) 
    {
       fbApp = new Facebook.FacebookClient(auth.Session.AccessToken);
    }
    isLoggedIntoFacebook = auth.IsAuthorized();
    var me = fbApp.Get("me");
    

    the trick was that i had to use the Authorizer class to actually find out if the user is logged into facebook and connected to my external website. i’m not sure how the authorizer works, but my guess is that it looks at cookies to find out if the user is logged into facebook (since the httpContext is passed into the Authorizer). then, assuming the user is logged into facebook and has authorized my app, my server side code can get the AccessToken from the Authorizer object to create a new FacebookClient, which can easily make calls to the graph api.

    also, in my case i used the FB JS SDK to popup dialogs that would log the user into facebook, then my serverside code was simply checking to make sure the user is logged in and then calling graphy apis to get information which i use on the server.

    i hope this helps someone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background Working in .NET 2.0 Here, reflecting lists in general. I was originally using
I'm trying to rebuild an old metronome application that was originally written using MFC
I'm trying to rebuild an old metronome application that was originally written using MFC
I have a website that was originally developed using a SQL Express database in
I am using some code which was originally taken from the Apple sample ViewTransitions
I originally asked this question on RefactorMyCode , but got no responses there... Basically
I originally asked this question , but in finding an answer, discovered that my
I'm deserializing a class called Method using .NET Serialization. Method contains a list of
We have an application written in C#, using .NET Framework 3.0 or 3.5 or
Originally there was the DAL object which my BO's called for info and then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.