Get suggestions for Occupation, College, etc. from Facebook - javascript

I'm writing a Facebook application, somewhat like a dating site (but not quite), and would like to allow my users to specify what kind of person they are looking for in terms of occupation, college, area, etc. I would like to make suggestions that match the suggestions Facebook provides when you change your own user profile details.
Of course, this could just be a text field, with some of my own custom AJAX suggestions, but is there not perhaps an API provided by Facebook for this sort of thing? If not an API, has anyone had success with using the same /ajax/typeahead/ script that facebook calls for this goal? How resistant is it to change?
Edit
I didn't mention any effort before - but that is basically because all my searches turned up nothing: I find no mention of this in the Facebook API, either the Graph API or the javascript SDK, and Google searches turned up nothing that I was looking for. Mostly people have only discussed the 'friend suggest' feature of Facebook in regards to any kind of 'suggestion', but not the AJAX-type autosuggest that I have in mind.

Look for this function at Facebook API and deprecated Legacy is what you get: http://developers.facebook.com/docs/reference/fbml/typeahead-input/
You have to look for something else than Facebook to implement it on your app.

Related

Wordpress to other source rest calls with username / password

I have been asked to create some custom content on a wordpress site, basically just some web app stuff (html/css/js), but leveraging data from another source via restcalls. There is a service account un/pwd required, and I am wondering what is best practice/approach in terms of the cross site calls with this un? The wire is encrypted but I certainly don't want to store the creds on the client (wordpress admin stuff). I am assuming there is a mechanism to store such on the 'back-end', filesystem, but I am not even sure such access exists? How you get to this....I have gone through the wordpress admin board and haven't found anything that provides access to the filesystem/php files, etc. Perhaps I am not looking in the right place or after the wrong bits?
I have googled but am such a noob with wordpress I am not even sure I have the right approach in mind; any help/advice is greatly appreciated.
EDIT: so if curl is the standard approach for this type of thing, where/how am I able to access the filesystem/php? Is there a specific place this type if thing lives or a convention of where it is placed? Just help with some 101 direction please.
First things first, you will need to develop a plugin for WordPress to properly hook into everything and play nice with everyone else. There are many tutorials for getting started. Here's one that integrates with an API
If you have to store things to make your plugin integrate with this third party, you should use the Options API that WP provides to you, with the information set from a settings page. Please don't hardcode that into a file somewhere in the code. (I'll also mention if you need something more powerful than the plugin options, you can add custom tables)
Now we have code running on WordPress with the information it needs, now it needs to do something. To pull the information from this third party, we can use PHP cURL.
Last, depending on how we want this information to end up being consumed by the user. We can do something simply such as just fetching/injecting the data during a regular WP page load on our custom page. Or we could be fancier and set up a WP REST API endpoint that re-serves the information we got from the 3rd party. Shortcodes? Widgets? Custom Templates? Filter Hooks? There is a lot of ways to present our final interface to the user.

Integrate Payment Gateway into NativeScript App

i am quite new to Mobile App Development, Payment Gateway implementation and NativeScript itself. Now i shall integrate an IPG into a Mobile App build with NativeScript to allow the user to buy goods via the Application (it is already possible to do so via the Website). I do not have any information regarding supported payment methods yet.
Whenever coding something i do have the opportunites to either write it on my own or use an existing open-source API. I've decided to try an open-source API to make it work.
My Problem is that i don't really know where to start. I have been doing some research on "how nativescript works" and Payment Gateway itself. Basically any JavaScript code is going to work with NativeScript, so any open-source API for IPG working with JavaScript should do it for my Application, right? Since i did not find any open-source API's for NativeScript itself, i started looking for any JavaScript API. Sadly, all if found was an API of telecash (https://www.telecash.de/produkte-services/e-commerce/support-fuer-entwickler/downloads-handbuecher/) (watch out, thats a german side), whose documentation seems quite fine, but it did not seem open-source.
So my Question(s):
Can anyone tell me a little bit about any experience you might have with that topic (perhaps just a link or a tip)? Maybe there is even another thing that i should start with that i have forgotten? And i think i did not understand the difference (if there is one) between Payment Gateways itself and IPG. Maybe someone can help me out on that.
I can not post code here since i am still on the "research"-phase (have been for quite a long time), but I can not see any progress within it so I am counting on your help. Feel free to correct me if I did a mistake or understood something wrong I mentioned here. :-)
Best regards.

Create a plugin to add my website functionalities on another website

I have a website A with a database and a search engine of some object, user can create account on my website then add comment for these objects.
I need to create an api with something like a plugin, it will result on having the seach engine on another website B.
I have planned to do like fb or twitter plugins : the dev who want to use my api will just need to add a line of js, and a line of html on website B, then it will load the plugin. But I'm wondering how to organize it.
Here it what I've guessed : I create a page on my website A, put the search engin on it. I create a js that will load this page whithin an iframe, on the dev's page (website B), under the div he added to have my plugin. Then I implement OAuth 2 (with a provider and so, so people can do post requests to alter my db), and people who is one the website B will have the ability to post comment on the objects of the search engine on website B.
Actually it seems to be the same as fb comment plugin process, but it seem too complicated to do all that stuff. Is it the right way? Can anyone detail the problems that I should face during implementation?
You need to develop a decent API which can return search result in JSON (and XML if you want to please everyone). That already would offer other developer the ability to use your site functionalities, that's mostly back end work tho. So they can develop their own widget.
To develop your own widget as a search widget you don't need that much, you just need either a set target (maybe a required element) or/and an initialization method (more flexibility for the dev) to which you pass a target.
Bind the search button, grab terms search, call your API and when you get your result display them or/and execute a custom callback pass the result as an argument, flexibility)
If you do your javascript well you can create a little API there too which facilitate the usage of your API via javascript. And then even easily port it to a jQuery plugin or something similar.
When serving JSON always remember to set your headers for your API to allow for crossdomain or go for jsonp instead.
Your question implies an architectural direction, but the requirements are too broad for such a choice. I would narrow down your requirements first. OAuth 2.0 could potentially help satisfy your needs, but ask yourself at least the following:
What user data needs to be protected?
What 3rd-party data access is needed? What functionality?
If you go with OAuth 2.0, are you prepared to follow a spec which is still changing? Are you willing to be the authentication provider?
What server-side languages/platforms are acceptable?
What other security considerations are important to you? (Such as social sharing, level of 3rd-party app trust...)
How much are you willing to rely on 3rd-party tools? Or write your own?
I agree that modeling your design off FB or Twitter or Google is not a bad idea, as they have done this sort of thing.
You might have a look at the new book Getting Started with OAuth 2.0.
Here are two simple ways of making custom search available to users.
The simplest option is to do what Google does - the search on your site would follow a simple, well defined API - so that
www.mysite.com/search?q=keyword1+keyword2
returns a list of results in HTML.
Then you'd tell your users to include a snippet of HTML:
<form action="http://www.mysite.com/search" method="get">
<input name="q" type="text" value="Search">
</form>
That would do, though at this juncture you may want to improve things with better search options, a javascript wrapper for the search form, a JSON or XML format for the data returned, security, a better worked out API that takes all these into account.
Another way is to use javascript and provide the data with a callback facility, so the URL:
www.mysite.com/js-search?q=keyword1+keyword2&callback=someHandle
will return a javascript file containing JSON data and a call to "someHandle" when it is loaded. The developer using your API have to write their own way of making the request and the handler. Bear in mind that because of XSS, the queries would probably come from your partners' servers. The simplest is probably to make your own search offer simple and well-documented so others can exploit it.
OAuth 2 could be helpful just if you would allow the website B to make POST request to the website A in background.
Instead if you want allow the users that visit the website B to post a comment then the iframe with a form that point to the website A is enough.
The easier bet, yet not necessarily the wisest, is to create some JS which calls on your website using JSONP.
iFrames are not W3C standard, try avoiding them if possible. Code a Javascript with some events that will do some JSONP calls into your own server and return the results in Javascript accordingly, so it would be able to interact with the page.

What is the best Facebook / Twitter SSO framework

I have a website where I want users to be able to leave reviews and rate products. I want some sort of SSO based system where they can use existing facebook / twitter accounts to "sign in". It is essential that I am able to uniquely identify them once they have so that they cannot rate products more than once etc.
What is the best system to use?
The requirements are:
Easy to implement
Lightweight
Facebook / Twitter integration
Ability to uniquely identify users
once they are signed on and possibly retrieve basic information such as First name and initial etc
You might also want to take a look at Wordpress, it is, in my opinion, one of the better frameworks for this sort of thing. There's a plugin called WP-FB AutoConnect here:
http://wordpress.org/extend/plugins/wp-fb-autoconnect/
Hope this helps
It sounds like you're looking for something like Janrain Engage which is a library that lets you integrate login with popular social media sites.
I think the only thing that comes close is YQL
I don't know what your skill level is, but if you don't want something like wordpress. I've used CodeIgniter with https://github.com/ericbae/Tank-Auth---3rd-Party-Authentication-Project
It gives you facebook, twitter and google friend connect.

App Engine and Facebook: which libraries to use?

I will be developing a web application with Google App Engine that will use Facebook Connect as the only means of registering / logging in. The web app will be written in Python. I need to know their name, profile pic, how many friends the user has, as well as their age and also possibly location, relationship status, work info, etc. (although those are mostly optional besides name, pic, age and friend count).
There seem to be a number of libraries that can do the task. There is the official Facebook Javascript SDK, minifb, and pyfacebook to name a few.
How do you think I should go about this task? Which libraries should I use, and what are the pros / cons?
Also to be considered is how well documented the code is and how widely it is used. If you can provide links to relevant example code / documentation, that would be greatly appreciated.
Facebook python-sdk has an example application to use Facebook connect with Google App Engine. I guess, you are looking for the same.
This should be a comment for the answer which suggests using the Facebook python-sdk.
Note that at github it says
This SDK is deprecated. It does not support the new cookie format that
we rolled out as part of the OAuth Migration. In short, it doesn't
work.
I've had success with the facebook-sdk project, which I believe is a fork of Facebook's original (and now dead) python-sdk project noted above. However you may also wish to check out EngineAuth.
Why don't you check out this similar question asked by another StackOverflow user:
Simple Facebook Connect in Google App Engine (Python)
There are some links provided here that sound exactly like what you're looking for.
For all specified detail you need to go with respective permission from users and then you can extract all specific information you needed.
You can go by either Graph Api or Javascript Api:
But with javascript you need to use many ajax request through your application where graph api only need access_token once for particular instance and also independent of client action.
Graph API also helps you in preventing use of other framework like pyfacebook, minifb, etc.
Apart from pros and cons you can also look some example code for both javascript and graph api
Hope this information will be useful to you.

Categories