How to post URL on friend's Facebook wall? - c#

I am creating Windows 8 app with C#/XAML. I want to share URL to logged in user's friend. Facebook has removed ability to post to friends walls via Graph API after 6th Feb, 2013. Facebook recommends to use feed dialog, but that dialog can be used with the JavaScript, iOS, and Android SDKs ONLY.
So how can I achieve this in WinRT ?
UPDATE 1
I found there's one more thing available that's URL Redirection. So I need to use WebView (which is one of worst control in WinRT) temporarily to open that URL and user will press "share". This way kills the UI/UX :(
UPDATE 2
I tried to use the URL Redirection, but I am getting error stating "An error occurred. Please try later". I searched about that, I tried all the ways like sandbox mode, double checking app ID but nothing worked for me. When I use app ID of graph api explorer it works.
Working
https://www.facebook.com/dialog/feed?app_id=145634995501895&display=popup&link=http://stackoverflow.com&name=Stack Overflow&picture=http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon#2.png&redirect_uri=https://developers.facebook.com/tools/explorer&description=Stack Overflow is a question and answer site for professional and enthusiast programmers.&to=100000692924752
Not working
https://www.facebook.com/dialog/feed?app_id=159248604260839&display=popup&link=http://stackoverflow.com&name=Stack Overflow&picture=http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon#2.png&redirect_uri=https://developers.facebook.com/tools/explorer&description=Stack Overflow is a question and answer site for professional and enthusiast programmers.&to=100000692924752

Related

facebook v2.2 login C#

I would like to code for a FacebookLoginDialog.cs programmed in Microsoft Visual Studio 2010 Ultimate in C#. As you may know, Facebook has upgraded its API to v2.2 and most of the information I find online is v2.0 which I am not sure if it is the same.
I tried looking at Facebook v2.0 Login with C# facebook sdk but I could not access the link provided in it and it's v2.0.
And everytime I run my code, I will face this problem when I get to facebook login.
The code is given by my friend but she did it one or two years back before the facebook api upgraded recently. There is no URL (or uri) in my friend's coding. but it works for her previously when she started coding.
I have no access to the app ID site that was created. I have created a new app ID but to no avail.
Please help! I am really in need of help.
Please check the site Url you have mentioned at the Facebook developer section.
I think problem may arise only for two reason
1> Incorrect Url at facebook developer site
2> navigateUrl parameter should be same when you send code for access token.
I've found how to solve this problem. The problem doesn't lies on the coding but the facebook developer site.
https://www.facebook.com/help/community/question/?id=542958419109491
Just enable the "Embedded browser OAuth Login" button and it will work.

Does the iOS Facebook in app browser behave differently to Safari?

I've just taken a Facebook app live (ie: it's a web app that lives at apps.facebook.com). The app is a simple form that allows you to vote for one of four options. When submitting the form for the vote we also capture the FB ID in order limit the user to 4 votes per day.
When testing this app in sandbox mode as well as live in any browsers, the app functions fine. It even has exception handling in the edge cases where the user is not FB authenticated etc.
The issue we have encountered is that when a user visits the app from within the iOS Facebook app, the link opens within the Facebook in app browser (based on the iOS UIWebView component I believe). When using it from this environment, when the form submits our server is producing a 500 error.
Now I know that the 500 error will be nothing to do with facebook since it is our application code, but my confusion arises from the fact that this only happens from the Facebook in app browser. We are currently going about trying to determine the nature of the 500 error (we do not have access the production environment and custom errors have been switched off).
My question is this: Does the Facebook in app browser behave differently or do things differently than the standard UIWebView or iOS Safari?
I am thinking of differences such as interfering with POST data, clearing FB login credentials etc.
In short yes the Facebook in app browser does behave differently than the standard UIWebView and iOS Safari web browser.
The Safari web browser and the UIWebView do use different user agents.
The Facebook embedded browser doesn't seem to post hidden form values. And I can't seem to find any debugging tools for the embedded browser used in the iOS app.
I might not be 100% true on this one but i think Facebook might still be using this browser for the iOS app. But support for this library has been discontinued and has not been updated in over 2 years.
https://github.com/facebook/three20/wiki/Using-integrated-web-browser-via-TTWebController
So in short the answer to your question is Yes, but finding a solution for this issue is another story.
I haven't found anything yet...
Good Luck!

Windows Phone 8 Facebook Authentication

I am working on an application for Windows Phone 8 and I'd like to give the possibility to the users to login with their Facebook account, so they won't have to create an account on my application.
I saw the Facebook SDK for .NET and decided to use it because it seems to be really efficient and popular.
As a beginner, I followed the tutorial in the doc of the SDK : http://facebooksdk.net/docs/phone/tutorial/
I did the exact same thing that in the tutorial, everything is okay since I login. I click on the login button, I'm redirected to what they call the "FacebookLoginPage" in the tutorial (a .xaml with an empty grid so the webbrowser can fit in it), then appears the webbrowser with the Facebook page where I can type my login and password. After that, I'm redirected to the page that asks for permissions on my Facebook account, I click on OK. Everything is good so far.
And then comes my problem. I should be redirected to what they call the "LandingPage" in the tutorial, but instead of that I'm redirected to the facebook "login_success" (https://www.facebook.com/connect/login_success.html‎) which displays "Success" and also a security warning, and then nothing happens anymore...
I thought something in my code was not right so I spend a couple of hours working on it, didn't find anything. So I tried to run the sample application that they provide in the doc of the website, I just modified the Facebook AppID in it (I've put mine), and same thing happened.
I also tried other things that I found on the Nokia Developer Wiki, same thing.
So I think something is wrong with my Facebook Application, but I can't find what it is...
Is anybody could give me some help ? I'm dying here :(
I apologize in advance for my english mistakes, and I wish you a good day !
UPDATE : I finally did it following this tutorial http://developer.nokia.com/Community/Wiki/Integrate_Facebook_to_Your_Windows_Phone_Application
The redirect to "https://www.facebook.com/connect/login_success.html‎" should contain the accessToken as a url parameter, so if you allow navigating to this url it is indeed a security risk as it exposes the AccessToken. You need to listen for the 'Navigating' event from the WebBrowser control and if the browser is navigating to "https://www.facebook.com/connect/login_success.html‎" then you need to cancel the navigation and get the AccessToken from the url parameter.
UPDATE:
It looks like FB changed their OAuth login response from ...login_success.html#access_token= to ...login_success.html?#access_token= There is now a "?" character before the "#" character.
I've seen this in a lot of apps in the store recently so it's probably not you doing something wrong but rather a change by Facebook which hasn't yet been reflected in the SDK.
Have you tried using Windows Azure Mobile Services Authentication instead?
See guides at http://www.windowsazure.com/en-us/develop/mobile/how-to-guides/register-for-facebook-authentication/ and http://www.windowsazure.com/en-us/develop/mobile/how-to-guides/register-for-facebook-authentication/ for more information.
I'm using the LoginButton control of the Facebook SDK .NET for WindowsPhone and have the same issue.
I Fix it, downloading the project from github Facebook-WinClient-Sdk and changing the line 186 of FacebookSessionClient class, for this one:
Uri endUri = new Uri("https://m.facebook.com/connect/login_success.html?#access_token");
The team of facebook sdk for .net will be fix this issue for sure, but i have a demo today and need it works!

Could not parse facebook oauth url

I'm fairly new to Facebook C# SDK, I followed exact same steps mentioned in the tutorial, but it didn't work, always showed "Could not parse facebook oauth url". That's the windows 8 sdk.
I then tried Windowns phone 8 sdk, every time I entered my username and password, a page with black "success" and red "SECURITY WARNING: Please treat the URL above as you would your password and do not share it with anyone." Here I downloaded the same sample source code and tried, same result.
I even downloaded the sample and ran it, same issue presented.
Does anybody run into this situation? Is it just me or something changed behind the scene?
Specs: windows 8 professional 64-bit, visual studio 2012 ultimate.
Thank you in advance.
Cheers,
Chao
I am really sorry to say I made a stupid mistake here, my Facebook app was in sandbox mode, so the url was only visible to developers and admins, since SDK is accessing the url as a visitor, stupid as me used my other account to access the app, 100% that I would be rejected.
So after I registered myself as a developer, this issue was resolved.

How to authorize my app with Facebook

I know I have seen apps that log me in using Facebook but never present me with an authorization screen. I can not, for the life of me, figure out how to do this with Windows Phone 7. The best I have been able to get is using the Facebook for C# SDK to get the authorization screen in a WebView. This looks hideous and the page does not even appear to be mobile ready.
I have searched high and low for an answer and have found nothing. Wondering if anyone can point me in the right direction to getting this to work?
Yes, I also saw this kind of apps (e.g. Spotify prompts you to enter your Facebook account credentials rather than using the normal authorization flow). My best guess is that they either some kind of premium partners and have access to some private APIs or they use custom authorization flows (e.g. when you authorize an app on a website, the system saves authorization key in the database. The same app id/secret is then used in Windows Phone app and all you need to do is to type in your email/username in order for the system to locate authorization key that was saved earlier).
I also don't like the approach of displaying Facebook login/auth using WebBrowser control (mostly because of UI inconsistency) but I'd say that this is still the way to go in most cases (because this is the official and recommended way of authorizing the app and all other approaches seem hacky for me and also have their disadvantages).
You will want to be using the "server-side authentication" approach. The following document describes how it works: Server-side authentication (read also OAuth Dialog documentation for how to configure the authentication dialog). You can change the way the UI looks by passing a display parameter (either to touch or wap).
Please note that display=touch is currently broken in Windows Phone - Facebook always falls back to wap which is deprecated and will be removed as per July 2012 update (corresponding case: Facebook API can't be used with Windows Phone apps). It's also among known issues on Facebook C# SDK project page: Facebook C# SDK - Known issues.
Hope this clarifies things a bit.

Categories

Resources