Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook C# SDK and Access Token

I'd like to be able to authenticate myself (my profile, not just my app) on my own web application using the Facebook C# SDK. Using the Graph API, I can get an access token, but that token does not seem to work properly with the Facebook C# as it seems to be stateless.

The error that is thrown is:

(OAuthException) An active access token must be used to query information about the current user.

I've poked around the Facebook C# SDK and documentation and most of the info I'm seeing is to redirect users to a login page which is not what I'm looking for.

Does anyone have a good sample of auto-logging in myself so I can pull up my own information?

TIA

like image 278
Jason N. Gaylord Avatar asked Mar 02 '11 17:03

Jason N. Gaylord


People also ask

Can people see who viewed their Facebook?

No, Facebook doesn't let people track who views their profile. Third-party apps also can't provide this functionality. If you come across an app that claims to offer this ability, please report the app. Was this helpful?


1 Answers

When you say "yourself" do you mean the app or your actual facebook user?

If it's just your app, you can get an access token by POSTing to this URL:

https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=APP_ID_HERE&client_secret=APP_SECRET_HERE

You can use this access token to perform actions on behalf of your users if they have authorized your app to do so.

like image 52
Max Avatar answered Oct 06 '22 01:10

Max