|
shezee611 |
User type : Standard |
Register : 2013-Apr-14 |
|
Topics : 1 |
Replies : 1 |
-------------- |
|
| | | If I try to login with same id where I created Fb App then it allow to login. Can you please explain why it's like that.
| | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | Hi sheezee611 I have never had this error myself, however according to the error message "error_code=901 error_message=This app is in sandbox mode Edit the app configuration at http://developers.facebook.com/apps to make the app publicly visible", you need to change your facebook application mode from sandbox to not-sandbox. - Go to https://developers.facebook.com and check that you Sandbox mode is On
- Click on the "Edit App" button and change Sandbox mode from Enabled to Disabled
- Click on the "Save Changes" button
- Wait 3 minutes
- Try your fbwrite.aspx file again
Please report the result back. | | | |
|
shezee611 |
User type : Standard |
Register : 2013-Apr-14 |
|
Topics : 1 |
Replies : 1 |
-------------- |
|
| | | I found the reason. Sandbox option should be "Disabled" which comes "Enabled" by default while creating App. | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | Ahh... you solved it, great | | | |
|
Anonymous |
-------------- |
|
| | | Do you know how to create Album and upload photos? I can see lot of codes using different SDKs but I wanna use direct url method as you did above. Appreciate your help. | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | |
|
Anonymous |
-------------- |
|
| | | how i get the main picture of my friends in the list fafcebook friends code? | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | Hi Anonymous To request say name, gender and profile picture for all your friends, you could use this url : string urlGetFriends = "https://graph.facebook.com/me/friends?fields=name,gender,picture&access_token=ACCESSTOKEN"; Facebook Graph API will now post back the requested fields (plus the id field) for each of your friends. string jsonFriends = RequestResponse(urlGetFriends); //RequestResponse is a class from the tutorial code above. The data posted by Facebook Graph API are formattet as JSON, which you need to parse into your own class : Friends friends = JsonConvert.DeserializeObject<Friends>(jsonFriends); You can reuse the Friends class from the tutorial code above, however you need to be sure that your Friend class have the matching properties, eg for the requested fields above you will need : public class Friend { public string id {get;set;} public string name {get;set;} public string gender {get;set;} public string picture {get;set;} } You can see much more in the Facebook Graph API documentation for the User class : http://developers.facebook.com/docs/reference/api/user/ | | | |
|
umer |
-------------- |
|
| | | Hi rasmus,
where do i wite this code to work properly should i make a new procedure or not | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | Hi Umer These 3 lines belong in the Facebook_ListFriends function from the "List Facebook friends" example code step 8 : "List Facebook friends" example code step 10 is the Friend class that you will have to change from : public class Friend { public string id { get; set; } public string name { get; set; } } , to : public class Friend { public string id {get;set;} public string name {get;set;} public string gender {get;set;} public string picture {get;set;} } | | | |
|
UMER |
-------------- |
|
| | | Thanks Rasmus... one more thing .... i am facing the following problem...
Authentication request errors OAuthException Invalid redirect_uri: Given URL is not allowed by the Application configuration.
in appendix i saw the solution but i can not find how to match redirect_ui with app domains?????
website with fb login uri =http://sociomatics.co.uk/ Ap domain=sociomatics.co.uk
can i use both at the same time | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | Hi Umer For you facebook app under basic settings, set : In case you get the error then you develop, in addition do the following : - In your hosts file (c:\windows\system32\drivers\etc\hosts) set :
127.0.0.1 localhost.sociomatics.co.uk - Say that in your browser you load your sociomatics dev website like :
http://localhost/myDevelopmentFolder/sociomatics then change that to : http://localhost.sociomatics.co.uk/myDevelopmentFolder/sociomatics (Say you use Visual Studio and press F5 to load your dev app in a browser, then simply manully write the ".sociomatics.co.uk" part after the "localhost" part).
Your redirect_uri will now be valid since localhost.sociomatics.co.uk is a sub domain of your Site Url and furthermore, on your dev machine, the now valid redirect_uri domain part (localhost.sociomatics.co.uk) will resolve to your localhost 127.0.0.1 so if executed on your machine, your browser will AFTER authentication be redirected to your dev code. | | | |
|
umer |
-------------- |
|
| | | Thank you rasmus.. my write on wall app is working now.. but still i am trying to do the friends part.....
i tried to edit the (c:\windows\system32\drivers\etc\hosts) but system did not allow me to do so..... kindly can you tell me how we can find the comments likes and shares count of our friends by showing them in grid???? | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | Hi Umer Apart from having a lot of fields, the User object also have a lot of connections. The connections you are asking for are probably : - feed (contains the last 25 posts)
- likes
- sharedposts
You can see all fields and connections as well as look up all objects here : http://developers.facebook.com/docs/reference/api/user/ I have never tried to request a connection, however note that while most fields are scalars, connections are arrays. I don't know, but I guess the following mechanism is a good guess of how to get the connections : string urlGetFriends = "https://graph.facebook.com/me/friends?fields=feed,likes,sharedposts&access_token=ACCESSTOKEN"; (you will need to test how JSON deserializer handle the arrays before you can create the correct Friend class) | | | |
|
titlemanager |
-------------- |
|
| | | Hi Rasmus,
I am a 49 year old unemployed programmer living in California. I just wanted to compliment you on the well written code that you have generously made available to us. I'm sure there are people all over the world who appreciate your work. I certainly am very grateful that you are a part of the world. I wish the best for you and your family, and your business ventures in your land of smiles. I plan to follow your expertise and guidance for as long as it is possible, and I hope to see another update on the progress of your life. Thank you again, Michael Kitterman | | | |
|
Pooja |
-------------- |
|
| | | How can i get News Feeds.? | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | |
|
Pooja |
-------------- |
|
| | | Hi Rasmus,
Thanks alot . i got that part working :) but the json string that is returned needs to be deserialized i searched for many posts but not able to find a simple way to do it. | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | Hi Pooja Then you get the json formatted feed data, you can see that it contains 2 properties : - id : just a string specifying the ID of the whom the feed belong to
- data : an array of objects (each object is one message)
The Message objects are themselves composite types and that makes the whole thing a little complicated, however to get started, you may choose to deserialize only some scalar properties of each message. I have not testet it, but I guess the following may work : string urlGetFeed = "https://graph.facebook.com/me?fields=feed&access_token=ACCESSTOKEN"; string jsonFeed = RequestResponse(urlGetFeed); //RequestResponse is a class from the tutorial code above Feed feed = JsonConvert.DeserializeObject<Feed>(jsonFeed);
You can now loop through the messages : foreach (Message message in feed.data.messages){ Response.Write("<br />" + message.story; } And here are the 3 supporting classes : (Feed, Data & Message) public class Feed { public string id {get;set;} public Data data {get;set;} } public class Data { public List<Message> messages {get;set;} } public class Message { public string id {get;set;} public string story {get;set;} public string picture {get;set;} } | | | |
|
Pooja |
-------------- |
|
| | | Hi Rasmus,
i got the deserialization part working as well. :) Thank you .
i wanted to know is it possible to do all these operations (read feeds/write/ retrieve friends etc ..) without logging into facebook and if i have the access token(which remains the same). | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | Hi Pooja I think the default access token expires 2 hours after it is granted, see the official how to handle expired access token. However, it may be possible to request a time extended access token, I am not sure. If you can confirm that it is either possible or not possible, please post your findings here. | | | |
|
Pooja |
-------------- |
|
| | | Hi Rasmus, Yes surely i will do that .My requirement is that if the user logs into my application he should be asked for the login and access permission only once like a single sign on. | | | |
|
SamLuther |
User type : Standard |
Register : 2013-Jun-10 |
|
Topics : 1 |
Replies : 3 |
-------------- |
|
| | | Hi Rasmus, I am trying to create new virtualhost in IIS7 as developer.supersite.com but when I navigate to http://www.developer.supersite.com I get HTTP 403 Forbidden error. The localhost is working fine. I tried adding the virtual host from both the host file in etc folder and also from the new website in IIS7 with no success. Can anyone please advise on how to resolve the issue? | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | Hi SamLuther
I cannot see how your post is related to facebook api, so I am going to delete your post in a couple of days.
I do plan to setup a forum here at webmodelling, there your post would give meaning. I hope to get the time maybe this week and maybe I transfer your post to that new forum. | | | |
|
SamLuther |
-------------- |
|
| | | Hi Rasmus, I was trying to follow the steps in "setup localhost development" while trying to use the facebook API hence posted the query in the thread itself. Feel free to move it any place where I can get an answer :) | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | Hi SamLuther
Sorry, I misunderstood you, your post is certainly relevant on this page.
Ok, lets get started by confirming the following : 1) IF you have added the following to your hosts file : 127.0.0.1 developer.supersite.com 2) AND in IIS you have binded a website to : developer.supersite.com 3) THEN you should be able to navigate your browser to : http://developer.supersite.com (don't use any www) | | | |
|
SamLuther |
User type : Standard |
Register : 2013-Jun-10 |
|
Topics : 1 |
Replies : 3 |
-------------- |
|
| | | It is working now. Thanks a lot! | | | |
|
Anonymous |
-------------- |
|
| | | How to logout using access token. | | | |
|
Anonymous |
-------------- |
|
| | | i am able to authorize user. but after that i need to add another user. For that i have to manually do sign out from Facebook then only my code work. so can you please suggest me how to sign out | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | Hi Anonymous (if you had logged in then posting, you would get an email notification immediately then this reply was submitted) I have never tried programmatically to logout a user, however it seems you can use the following url : https://www.facebook.com/logout.php?next=REDIRECTURL&access_token=ACCESSTOKEN , which takes 2 parameters : - next : which is the url facebook should redirect your browser to, eg. next=http://webmodelling.com/facebook-api.aspx
- access_token : which is the access token obtained for the user you are about to logout.
| | | |
|
sarinsoman |
User type : Standard |
Register : 2013-Jul-13 |
|
Topics : 0 |
Replies : 1 |
-------------- |
|
| | | Hi Rasmus,
Excellent tutorial.Thanks for your effort.
I am looking for a sample codes for the following 1)Post photo(not thumbnail image) to facebook page. 2) Read the feeds from the Page(including the user profile image) 3)How can i display a post from page (including the comments for that post. 4) Read a page post and put comment on that post
Please guide me how can i implement all the above.
Thanks in advance
Sarin | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | |
|
Anonymous |
-------------- |
|
| | | Hi Rasmus,
I copied and paste ur code, but it doesnt work anymore. It returns:
"could not post : The remote server returned an error: (400) Bad Request." | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | Hi Anonymous
I am not sure what you mean by "anymore" - have it worked earlier and then stopped working ?
In case you have just copied and pasted the code, I recommend you to read the whole tutorial and don't forget to create a facebook application. Btw. the code you download is identical to the code running behind this page and you can use the "Try it out" section to confirm that the code is working. | | | |
|
Alan |
-------------- |
|
| | | Hi Rasmus,
I hv read through tis article, on the "Write to Facebook wall" section.
After I click submit button, it managed to get the access_token, but it fb server returned: "could not post :The remote server returned an error: (400) Bad Request."
However I managed to post to wall with only "message" in the entityMessage, without "name, link, caption, and picture" like you did in this tutorial. I tried on ur "Try it out" sample, it worked perfectly, i hv no idea why mine doesnt work... | | | |
|
twlalan2 |
-------------- |
|
| | | thank you for this article, you just saved my day!
Would love to see more article/tutorial from you Rasmus! Can you do more tutorial on social media using asp.net? for example, post status update on twitter, invite fb friends using fb app, etc.
Good day. | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | Hi twlalan2
Really nice to hear. However it is unlikely for me to produce any social media using asp.net tutorials in the near future. I have multiple exciting projects going on and far too little time. | | | |
|
Anonymous |
-------------- |
|
| | | Hi! How can I read post from my wall using FacebookClient ? Or thomething else ? And how can I read number of likes of someone post? Thanks. | | | |
|
astahir |
User type : Standard |
Register : 2013-Sep-20 |
|
Topics : 0 |
Replies : 3 |
-------------- |
|
| | | Hi Rasmus,
Thank you for a well-written article. I will definitely give it a try but for now I need your guidance in a specific matter. Basically I need to develop a POC and the requirement is that I enter an email address and my page fetches the publicly available info against that email address. I have never used Graph API before and I need to write it in an ASP.NET application using C#.
Can you guide me to a tutorial / article that takes me step by step to achieve what I am looking for? Simply put, I just enter an email address and fetch all publicly available data against it.
Thanks in advance.
Ahmed | | | |
|
astahir |
User type : Standard |
Register : 2013-Sep-20 |
|
Topics : 0 |
Replies : 3 |
-------------- |
|
| | | Where did my whole comment go?! | | | |
|
astahir |
User type : Standard |
Register : 2013-Sep-20 |
|
Topics : 0 |
Replies : 3 |
-------------- |
|
| | | Okay I see it now...Please ignore this comment! | | | |
|
Talib |
-------------- |
|
| | | you can access the fiends info like this
$facebook->api('me/friends?fields=picture,name,gender');
for more info visit the given below link
http://howtoblogr.blogspot.com/2013/10/how-to-count-all-your-facebook-friends.html | | | |
|
mahmoudnassereldine |
User type : Standard |
Register : 2013-Dec-18 |
|
Topics : 0 |
Replies : 1 |
-------------- |
|
| | | dear Rasmus i put the appid and app scret like here : <appSettings> <add key="facebook:AppId" value="xxxxxxxxxxxxxxxxxxxx"/> <add key="facebook:AppSecret" value="xxxxxxxxxxxxxxxxxx"/> </appSettings> she don t work and it display this error : { "error": { "message": "Missing client_id parameter.", "type": "OAuthException", "code": 101 }}
can you help me ? | | mimo | |
|
Anonymous |
-------------- |
|
| | | dear rasmus a have now this error : Server Error in '/' Application.
A potentially dangerous Request.Path value was detected from the client (:).Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: A potentially dangerous Request.Path value was detected from the client (:).
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
[HttpException (0x80004005): A potentially dangerous Request.Path value was detected from the client (:).] System.Web.HttpRequest.ValidateInputIfRequiredByConfig() +9673044 System.Web.PipelineStepManager.ValidateHelper(HttpContext context) +53
|
| | | |
|
ravi |
-------------- |
|
| | | i have followed ur code
Httppost method returns The remote server returned an error: (400) Bad Request. | | | |
|
Anonymous |
-------------- |
|
| | | Hi Ramus, I am getting this exception.. could not post : The remote server returned an error: (403) Forbidden.what went wrong...please let me know..
| | | |
|
dfdssdf |
-------------- |
|
| | | |
|
zmbhutta |
-------------- |
|
| | | Hi, I am getting error "
The remote server returned an error: (403) Forbidden." | | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | |
|
Saksena |
-------------- |
|
| | | Hi sir, Thanks for your wonderfull post,I have strucked up with an strange thing for about 4 days pls help me out. am able to get my own profile details but not my friends list if i specify the dataType="friendlist" am getting my names of my friend list like close friends,family and all but datatype="friends" doesnt return my friends list pls pls help me out
Thanks in advance
| | | |
|
Rasmus |
User type : Admin |
Register : 2012-Dec-21 |
|
Topics : 0 |
Replies : 106 |
-------------- |
|
| | | Hi Saksena
To be honest I am little rusty on the topic, however please start by trying to click on the "List your Facebook friends" button in the above "Try it out" section. Then I click the button myself, I correctly get a list of friends. Then you click the button, please post the result here. | | | |
|
ferose |
User type : Standard |
Register : 2014-Sep-18 |
|
Topics : 0 |
Replies : 1 |
-------------- |
|
| | | Please help me to solve the issue: I used your code it returned the following error: The remote server returned an error: (403) Forbidden.while debugging error thrown by below line Response.Redirect(urlAuthorize, true);
| | | |
|
Anonymous |
-------------- |
|
| | | Hi Rasmus, I used your code, its working well but i wanted to show facebook share dialog box before posting message on my fb account. | | | |
|
Anonymous |
-------------- |
|
| | | Hi Rasmus, I used your code, its working well but i wanted to show facebook share dialog box before posting message on my fb account. | | | |
|
kiquenet |
-------------- |
|
| | | Suggestions for add full samples. (for Unit Test project VS 2013, and Windows Forms app too.) More about Facebook SDK C# for 1) from me and other users: post to wall, post photo to album, download photos from album share post with another user (maybe send messages) share photo with another user (maybe send messages) share page with another user do like and unlike to a post do like and unlike to a page get friend list and info data 2) from me delete post delete photo from album delete album create new album | | | |
|
Anonymous |
-------------- |
|
| | | |
|
DJ |
-------------- |
|
| | | Hi Rasmus, I am getting following error: could not post : The remote server returned an error: (403) Forbidden.as you have mentioned in reply to SamLuther querry I have done all things but still getting same error. my Url are correct. Please help me out. | | | |