Doing Facebook OAuth with Nokia S40/J2ME devices using App42 Platform

Nokia Asha 3101 Doing Facebook OAuth with Nokia S40/J2ME devices using App42 Platform

Nokia S 40 Asha Series

Doing Facbook OAuth on Nokia S40 and J2ME devices is the biggest challenge while creating the social Apps for this platform because of unavailability of the Facebook J2ME SDK and inapp browser limitation of J2ME devices. App42 platform J2ME SDK provides an easiest and quickest way to do seamless Facebook OAuth on J2ME devices without going in to the complexity of underlying protocol.

Here are the few easy steps to do the FB OAuth for these devices.

1
2
Canvas URL : https://api.shephertz.com/cloud/1.0/social/facebook/saveFeaturePhoneFBToken?
Secure Canvas URL : https://apps.shephertz.com/socialkeys.php?
  • Also, make sure that sandbox mode is off for your app.
  • Register with App42 platform if not already registered and create an app for you.
  • Download the latest J2ME SDK from our public Git repo
  • Unzip the downloaded file and put App42_J2ME-x.x.x.jar in your project class path.
  • Now you are ready to do Facebook OAuth with just few lines of code as shown below
1
2
3
4
5
6
7
8
9
10
11
12
13
14
ServiceAPI  sp = new ServiceAPI("YOUR_API_KEY","YOUR_SECRET_KEY");
String fbAppId = "YOUR_FB_APPID";
String fbAppSecret = "YOUR_FB_APP_SECRET";
 
String accessToken = null;
String [] appPermissions = new String [] {"publish_stream","friends_online_presence"};
String code = sp.buildSocialService().doFBOAuthAndGetToken(midlet, fbAppId, appPermissions);
//The Above call will open user login OAuth page in browser and will wait till user authorizes the app.
 
accessToken = sp.buildSocialService().getAccessTokenFromCode(code, fbAppId, fbAppSecret);
System.out.println( "  Token : " + accessToken);
Social socialObj = sp.buildSocialService().getFacebookFriendsFromAccessToken(accessToken);
Vector friendList = socialObj.getFriendList();
//This will return Facebook friends of user whose access token was passed.
  • In above snippet doFBOAuthAndGetToken method will do all the trick, it will open FB user OAuth page and will wait till user authorizes the app.
  • Once user does the authorization, user’s acccesscode is redirected to our server and being further received by your app and being returned by this method.
  • Once you have got the acceess code you can make another call getAccessTokenFromCode to get the access token of that user.
  • The whole story ends once you get the access token with you. Now you can call getFacebookFriendsFromAccessToken on our SDK or can directly use facebook graph API for fetching other information of user.

You can use other App42 backend services like Gaming, Storage, File Storage, Messaging, Geo Spatial, Custom Code to make user engaging social app with writing any backend for J2ME/S40 devices. Start making beautiful Apps with App42 Cloud API S40 SDK. Here is the Sample Code to get you started.

more on pricing Doing Facebook OAuth with Nokia S40/J2ME devices using App42 Platformget started Doing Facebook OAuth with Nokia S40/J2ME devices using App42 Platform
twitter Doing Facebook OAuth with Nokia S40/J2ME devices using App42 Platformfacebook Doing Facebook OAuth with Nokia S40/J2ME devices using App42 Platformgoogle Doing Facebook OAuth with Nokia S40/J2ME devices using App42 Platformlinkedin Doing Facebook OAuth with Nokia S40/J2ME devices using App42 Platformpinterest Doing Facebook OAuth with Nokia S40/J2ME devices using App42 Platformreddit Doing Facebook OAuth with Nokia S40/J2ME devices using App42 Platformstumbleupon Doing Facebook OAuth with Nokia S40/J2ME devices using App42 Platformtumblr Doing Facebook OAuth with Nokia S40/J2ME devices using App42 Platform

Leave a Reply

Your email address will not be published. Required fields are marked *


6 − = one

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>