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.
Related
I needed to implement speech 'identification', ie. Guess if the person who is trying to login, is actually him/her, by matching his/her voice.
To consider the case, where the app doesn't recognize the person, but the user is himself trying to login, then he may bypass it with a pin, setup during initial settings.
I am using Python and Flask, to build the webapp, and included javascript in the question, so as to know of possible ways in it too.
Till now, i read about it from some sources, but i couldn't arrive at a possible solution, on stack overflow, as well as 'few' blog posts.
The best 'possible' solution i could arrive at was Cognitive Speech Services by Microsoft -
https://azure.microsoft.com/en-us/services/cognitive-services/speaker-recognition/
I also thought of recording the voice using the Recorder.js, and analyzing at the server end, but couldn't implement it.
So, i wanted a way to implement it on the web app, even a simple gist with a bit of code on using ms cognitive services (i did read pages of the documentation, but it didnt help much), or doing it by python will be helpful.
The documentation at https://learn.microsoft.com/en-us/azure/cognitive-services/speaker-recognition/home will be helpful. Note that there are clickthrough links to the API reference. It explains the high-level process (use “enrollment” to train).
We have speaker identification, which is distinguishing who is speaking from a group of known voices that you train with. You need to provide labelled data (meaning examples of a known speaker talking): see https://westus.dev.cognitive.microsoft.com/docs/services/563309b6778daf02acc0a508/operations/5645c3271984551c84ec6797.
or
Please follow the below link speech SDK samples.
https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/
You can use batch transcription api and enable diarization.
https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/batch-transcription
As #Ram pointed out that we can use the Microsoft Cognitive Services, we used the same to implement it.
First, we needed an API key from Microsoft for the Cognitive Speech Service (they give a 2 keys, and an endpoint for 7 days in a free trial, without any card, and another free version for a year maybe, with card details)
Get the API keys here : https://azure.microsoft.com/en-in/try/cognitive-services/?unauthorized=1
Then, i went through the documentation of Microsoft, but couldn't really be helped by it.
What helped was this : https://github.com/rposbo/speaker-recognition-api
I went through all files, and the 'needed' part was mainly in the speech-recognition-api-demo-core.js and the demo.html
First understand what it's really doing, then only you can implement it on your page.
That actually concludes the answer, since that's how it 'can' be implemented using Javascript.
Extra - https://github.com/AdityaGupta150/ProtoMain - We have used only the needed part of Robin posbo's code (you won't be able to just copy paste, first understand it), and implemented it, you can see that in templates/verification.html
I'm trying to implement a OAuth2 appcelerator connector for Studio to connect to a wordpress (WP has installed plugins REST API, OAuth2 server). And appcelerator download this module https://github.com/JiriChara/titanium-oauth2-client, but it is a version of 2012 which certainly has flaws. Unfortunately I could not make them work together.
I want to ask the community (Since it is the first time I am developing this type of connection between an app and a website in wordpress), if they have any solution please.
Thank you very much
I think that since the oAuth protocol hasn't changed, you should still be able to use that library you linked to. I see that it hasn't been updated in a while - and maybe that's because there is nothing to update.
If you encounter specific problems using the library you can clone the source and try to fix (maybe even revive the project and push back to GIT).
Basically, oAuth is a set of HTTP calls - so you can write it on your own. But since a lot of the job was already made in that module I would try to get it working and push whatever fixes I can so others searching for the same thing can enjoy it as well.
Take a look at this repo. It is an Appcelerator Titanium widget that was written to work with Azure oAuth2 but it would only take slight modifications to make it work with other oAuth2 systems. I was successful doing this for a recent project.
https://github.com/grantges/co.grantges.azure.adal
The first is that they can update the code (include to require) . I also try to take this module, but does not work .
regards
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.
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.
I saw few tutorials mentioning showFeedDialog, but none that mention how to use publishUserAction. what is the difference anyway?
Is there anyway to use showFeedDialog without prompting the user ?
Are there any good tutorial on how to use publishUserAction?
why does publishuseraction have a suqeuncebase parameter while showfeedialog doesn't have
1) showFeedDialog is a Javascript-only method that is used to render a UI element. Specifically, it renders a dialog box that prompts a user to publish a story to their profile (or a friend's profile). It can be used via Facebook Javascript (FBJS), or the Facebook Connect Javascript libraries.
publishUserAction is an API method, and can be called using any of the Facebook API libraries, including the server-side ones. You don't need a user's confirmation to publish something using this call. However, it can now only publish one-line stories by default, and these do not appear in the main news feed anymore.
The doc pages for showFeedDialog and publishUserAction have some examples, albeit small and not entirely useful ones.
2) There is not, unfortunately, unless the user has granted extended permissions to your application. You generally have to prompt for extended permissions as well.
3) Facebook's documentation is very poor. Your best bet is usually to check out the API documentation on the specific method you want to use, google around like a crazy person, then set up a test in a development application.
4) Only API calls that rely on a session require the sig parameter (deprecated functions had a separate call_id parameter, but that has been rolled into sig in newer versions of the API functions). showFeedDialog is not an API call, it's a Javascript library call, and it handles all the necessary API stuff for a feed prompt in the background.