I've been working with connecting my applications to social services for last week.
Didn't here anything about its APIs before. So, I started to look up for information about this and found this posts:
But there is an another choice - spring-social. It has not only request-response logic implementation but also full-featured facebook and twitter APIs. E.g. to update facebook status we just need do this:
The only thing we need is to get OAuth access token for needed social service. The way to do this is during application authorization process. All technical details you can find on oauth.net.
Let's I describe the process step-by-step:
Source code: GitHub.
That's all I can say about this library. The only thing missed is other social service. Will try with them later.
To be continue...
- http://tawus.wordpress.com/2011/08/14/tweeting-with-tapestry/
- http://tawus.wordpress.com/2011/08/15/tapestry-facebook-integration/
But there is an another choice - spring-social. It has not only request-response logic implementation but also full-featured facebook and twitter APIs. E.g. to update facebook status we just need do this:
The only thing we need is to get OAuth access token for needed social service. The way to do this is during application authorization process. All technical details you can find on oauth.net.
Let's I describe the process step-by-step:
- First of all you should register your application:
- facebook - https://developers.facebook.com/apps/
- twitter - https://dev.twitter.com/apps/new
- After creation your application you will get client token and secret that are necessary to configure your social services
- Then you need to configure social services with this tokens in some of your application modules. In my variant it looks like this:
- You need to place links to social services authorization page for users.
So they will be authorized in social service and then will come back to your application.
For my applications I've created such connect buttons(they are very simmilar to the ones proposed by tawus):
Both buttons will redirect to correspondent social authorization page and then return back to page they came from. If authorization was successful they will trigger success event with access token as event context, so end developers can access private social APIs. If authorization was failed by any reason they will trigger failure event. So, the only thing we need is to place this buttons on page and implement success and failure event handlers here. - Use received access tokens to make some operations with social API.
In my example after social connection application requests user's profile and displays information. It looks like this:
Source code: GitHub.
That's all I can say about this library. The only thing missed is other social service. Will try with them later.
To be continue...
Nice. Good work !
ReplyDeleteUber!
ReplyDelete