Sunday, 15 January 2012

java - SocialAuth - Facebook Authentication - Specify which access rights are requested -


I want to realize simple login through Facebook on my website. I used SocialAuth for it and it is working very well. But if I log in through Facebook, then the Facebook app needs to confirm too much access rights, such as posting on the wall and so on.

I do not need this right, can I define somehow whose rights are requested (basically I do not want anyone - just login). This is my code:

  // Create an example of the SocialAuthConfgi object SocialAuthConfig config = SocialAuthConfig.getDefault (); // Load Configuration by default loading the configuration from oauth_consumer.properties // You can also pass input stream, property object or property file name. Config.load (); // Make an example of SocialAuthManager and set up the configuration SocialAuthManager manager = new SocialAuthManager (); Manager.setSocialAuthConfig (config); // Your application's URL, which will be followed after the authentication string success URL = "http://opensource.brickred.com/socialauthdemo/socialAuthSuccessAction.do"; Get // Provider URL for which you should redirect to authentication. // ID can contain "Facebook", "Twitter", "Yahoo" etc. or OpenIDER URL string URL = Manager. Attenuation URL (ID, Success URL); // Store in session session.SetAttribute ("authManager", manager);   

My configuration looks something like this, can I define it in some way?

  #facebook graph.facebook.com.consumer_key = 152190004803645 graph.facebook.com.consumer_secret = 64c94bd02180b0ade85889b44b2ba7c4 graph.facebook.com.secure = true graph Facebook.com.request_token_url = / oauth / access_token graph.facebook.com.authorization_url = / oauth / author graph.facebook.com.access_token_url = / me graph.facebook.com.signature_method = HMAC-SHA1 graph.facebook.com. Transport_name = Received    

You can add custom permissions in this way.

  graph.facebook.com.consumer_key = 152190004803645 graph.facebook.com.consumer_secret = 64c94bd02180b0ade85889b44b2ba7c4 graph.facebook.com.custom_permission = email, user_birthday, USER_LOCATION   

No need to set other properties but you want to set other properties, then you can set the request_token_url, authentication_url and access_token_url (for OAuth1.0). This feature is available from socialauth-4.2

  graph.facebook.com.authentication_url graph.facebook.com.access_token_url    

No comments:

Post a Comment