Building a desktop facebook application - javascript

I am trying to build a Desktop Facebook application which will display the list of friends of a logged-in user. I am trying to do this using the Facebook javascript SDK. However when I open the HTML page, i get the following error:
Given URL is not allowed by the Application configuration.: One or
more of the given URLs is not allowed by the Application
configuration. It must match one of the Connect or Canvas URLs or
domain must be the same as or a subdomain of one of the Application
I do understand that Facebook is asking for a URL from where this application will be called. However I would like to just run it by opening a HTML file from my local drive, rather than through a website. Is this possible to do?
There is a post on facebook (https://developers.facebook.com/bugs/165982843535513/) which indicates that this might not be possible. However the post was made about 3 years ago. Is there a possible work around for this currently?

You have to build a manual login flow:
To use Facebook Login in a desktop app, you'll need to be able to
embed a web browser (sometimes called a webview) within the app to
perform the login process.
Source: https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/v2.3
Just in case you donĀ“t know, you can only get friends who authorized your App too.

Related

Window Active Directory React JS Auto Authentication

I am trying to get it so that when the user on the local network opens up the webpage it will log them in with their active directory username and password through a react js system with a C# API back-end. would react just say someone has connected on load and then send a message to the web api telling it to pull the user and authenticated it pushing that to the webpage for me to use as the login details.
You can achieve by using common authentication/authorization protocol OAuth 2, which is commonly used.
for example google have different product like gmail, drive, doc etc which is hosted in different domain. But when you login in any of this domain, you don't require to login again in any of its product. it use Signle Sign on concept

Single Sign On Html Page with Restful Service

Let me explain what's my plan.
Actually I write a website in HTML5 with Javascript.
This website do an ajax call to a c# RESTful service.
Both, the website and the service, are located on a windows server 2012 at the iis 8.
The website is located in an virtual directory of the default web site.
The service is added as an application to the server.
The server is running inside our intranet including AD.
I access the website by the url: http://example/Auth.
My goal is that the user didn't have to login manually, because it's already done at windows login.
This should be done by using windows authentication i guess, but when i activate it, i'm prompted to enter my credentials.
After entering them everything works fine. If they were correct i can use the website, otherwise i get 401 as expected.
First question: what do i have to do, to be logged in automatically if i'm a valid user of the AD?
Wheter logged in automatically or manually i'm not able to get the username of the logged in user and pass it to the service.
Second question: how to get the username and pass it to the server?
In my case it was finally quite simple to solve my problem.
All i had to do, was to add the domain to the url and get a full qualified url like: example.mydomain.com/Auth.
If i try toaccess this site now, there is no prompt shown and even the credentials get passed to auth following services etc.

Protecting iframe src using server side rendering

I have to display a third party site, say site X, upon successful authentication from my existing APIs, as it is, on my web site. But due to certain reasons, I cannot afford to use an iframe, which is the most obvious solution in this case, as that will expose the site X's URL when inspected in browser. So, I landed up on another idea to create a web app whose front end is written in AngularJS and use existing back end APIs written in C#. The application will basically have two pages, login and main page. Upon successful authentication from API on login page, user is navigated to main page. Now main page, I have to show another site. So, instead of using iframe on main page having source as site X, I will display an iframe with source Url as one of my API endpoint, say baseURL/data. So, this API will basically fetch the site X data and do something like server side rendering and return me an exact replica of site X which I will load in my webapp. When user will navigate on site X and route to any path, that route will be sent to same API and now the response will be replica of baseURL/data/route. Even though my API endpoint is now exposed instead of site X url in browser console, I am okay with this because that API is protected somehow and cannot be accessed as it is without proper authentication which I am doing in my case on login page.
I want to get more thoughts on this entire scenario and possible alternatives. Also, if anyone can suggest if/how it is possible to write such an API. I can think about changing AngularJS or C# as technologies in my project but definitely that's not the most go-to-solution for me. Any suggestions and thoughts are welcome!
Edit: I have created a site using a static site generator. I want my users to be able to access that site only if they are 'my users' i.e. authenticated by my APIs. But, that generator is not allowing me to integrate my API and neither I can get the static assets like .html, .css and .js files that I can host on my own server and integrate my authentication API. Hence, I had to think about a workaround like this.

Google crawler can't render the page properly

For the past months I have been developing my own "javascript client side framework for SPA(single page application)" and I just want to know if I'm on the right track or not.
My framework works similar to meteor or ember and others but I've noticed that google bot has difficulties rendering my page. so I want to review some of the rendering techniques that I have used in my framework.
When the user navigates to a url ex. http://mywebsite.com/profile/tomhanks the router parses the url and finds that there is a controller listening to string profile/[username] so it triggers that controller and passes username as a variable to the controller, then the controller requests a new page (or overlay) with a template id and then the template is placed in the page.
But the problem is that Google bot won't bother doing all of this and only sees the empty html page. And I know this from fetch as Google in the Google Webmaster Tools.
How do other framworks do it? How come Google can fetch those contents correctly?
Google crawler can't guess what to type in the URL. To help the bot you should create a sitemap with all possible URLs so that the crawler can visit them: Learn about sitemaps
This can also be of your interest: Making AJAX applications crawlable.

How to link from a webpage to Facebook STATUS in iOS native Facebook app via fb://

I've seen a fair amount of stuff about retrieving a Facebook user profile or page via fb:// from within a webpage to direct iOS to open the profile or page in the native Facebook app rather than in the browser on iOS devices. However, I see nothing about how to do so for Facebook status updates.
The behavior I am looking for is to provide a link to a Facebook status on a webpage (HTML5) and when the user clicks on it, to have the user be switched over to Facebook's native app and have the status show up in the app. My question is specific to status updates (sometimes called posts), and not pages or user profiles.
If it helps at all, the link is presented in a Sencha application packaged in PhoneGap/Cordova.
Any help would be much appreciated. I haven't seen anything directly on point around the web.
Isn't a status is just a type of post?
if so, you can find the postid of it and then use "fb://post/(postId)"
The solution is that you need to add userid and an "_" before the actual post id for it to work. most of the data you get back via graph or whatever sdk has the post id as just the single id without the users id and an underscore in front of it.
so it would look like:
fb://post/453453454_34857894375345
first set of numbers being the userid(not an actual one) and the second being the post id(also just random numbers i typed).
haven't tested going from web to native, but just tested it in a native app we made that successfully opens the facebook app to that specific post.

Categories