.net - Facebook integration with C# desktop application -


im going dive straight in , give little background on im trying do, i've tried, , obstacles in way. here goes..

my goal
post facebook profile or wall desktop application.
desktop application used individual users have own facebook account.
aim create each user own facebook app , app id , app secret.
, use app id , app secret in desktop application ( saved somewhere in database or config ) allow user of desktop application post profile without having enter email address , password login first

so in summary, 1 facebook app per facebook account.
app settings saved in each users desktop application post own facebook via own facebook app without logging in

the main emphasis here being user not have log in manually via window or browser.

i have created facebook app , have set live status.. have added in possible permissions , extended permissions in settings ( within facebook ) make sure wasnt missing anything. have appid , app secret.. have client token says use in place of app secret 'auth methods'. use access token. tried app secret , doesnt return access token

my attempts :

c# facebook sdk so, started , still trying use c# sdk
can retrieve access token cannot post.

i below errors time whatever try... these 2 of many code examples have tried.
(oauthexception - #2500) active access token must used query information current user.

dynamic r = fb.post("me/feed", new { message = "my seconds wall post using facebook c# sdk" });

(oauthexception - #190) client token cannot used api

dynamic r = fb.post("kevin.maguire.965/feed", new { message = "my second wall post using facebook c# sdk" });

i read following extract below link states access token app token , need access token user or page? need on oauthexception code 2500 error 2500 means have no access token or app access token trying access /me/ - 'me' placeholder 'current user or page id' won't valid without access token user or page

so, have tried userid using following answer ( facebook c# sdk current user )

var fb = new facebookclient("access_token"); dynamic result = fb.get("me", new [] { fields = "id" }); var userid = result.id; 

i access token assume app token , not user token

dynamic result = fb.get("oauth/access_token", new         {             client_id = this.applicationid,             client_secret = this.appsecret,             grant_type = "client_credentials"         });  fb.accesstoken = result.access_token; 

so have no idea @ moment in time how post profile

i able achieve above using twitter can use secret, token, id etc ... provide , can post twitter account desktop application without logging twitter account.

another user has found quite easy post twitter without real issues. ( facebook c# sdk getting started )

he seems have had success have not using same code - code uses in june 2012 there have been breaking changes released since then.
got message : (oauthexception - #2500) active access token must used query information current user... when used sdk. when tried access token using web request , pass token sdk object create facebookclient got message (oauthexception - #190) invalid oauth access token signature.

    webrequest request = webrequest.create("https://graph.facebook.com/oauth/access_token?      grant_type=client_credentials&client_id=999999999999999&client_secret=edefefr8e09r8e08r080r8er0e");          request.method = "post";          // set contenttype property of webrequest.         request.contenttype = "application/x-www-form-urlencoded";          // request stream.         stream datastream = request.getrequeststream();          // close stream object.         datastream.close();          // response.         webresponse response = request.getresponse();         datastream = response.getresponsestream();          // open stream using streamreader easy access.         streamreader reader = new streamreader(datastream);          // read content.         string accesstoken = reader.readtoend();         messagebox.show("accesstoken")           // clean streams.         reader.close();         datastream.close();         response.close();          var fb = new facebookclient(accesstoken);         dynamic parameters = new expandoobject();         parameters.message = "test";         dynamic result = fb.post("me/feed", parameters);         var id = result.id; 

obviously in code above changed id , secret dummy values.

so folks...the above links , above code pinch of have tried date in last few days... i've ran out of options , missing here averting attention easily.. or maybe not :) dont know.

if 1 have simple windows form, or wpf window application example using c# sdk or using restsharp or using webrequest object 'post' method eternally greatful.

just iterate again desktop application , not asp.net .

many folks attention , time.

enter image description here

enter image description here

enter image description here

enter image description here

from can see supplying incorrect access token. since haven't provided code regards obtaining access token, may suggest take @ link explains how build facebook application, including obtaining access token via webbrowser control.

edit: supplying app access token trying post user. operation need user access token can obtain following steps in link above.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -