Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java SocialAuth-Facebook身份验证-指定请求的访问权限_Java_Facebook_Authentication_Oauth_Socialauth - Fatal编程技术网

Java SocialAuth-Facebook身份验证-指定请求的访问权限

Java SocialAuth-Facebook身份验证-指定请求的访问权限,java,facebook,authentication,oauth,socialauth,Java,Facebook,Authentication,Oauth,Socialauth,我想通过facebook在我的网站上实现一个简单的登录。我使用了SocialAuth,它运行得很好。但是,如果我通过facebook登录,facebook应用程序需要确认许多访问权限,如张贴到墙上等等 我不需要这个权利。我是否可以定义请求的权限(基本上我不需要任何权限,只需要登录)。这是我的代码: //Create an instance of SocialAuthConfgi object SocialAuthConfig config = SocialAuthConfig.getDef

我想通过facebook在我的网站上实现一个简单的登录。我使用了SocialAuth,它运行得很好。但是,如果我通过facebook登录,facebook应用程序需要确认许多访问权限,如张贴到墙上等等

我不需要这个权利。我是否可以定义请求的权限(基本上我不需要任何权限,只需要登录)。这是我的代码:

//Create an instance of SocialAuthConfgi object
   SocialAuthConfig config = SocialAuthConfig.getDefault();

  //load configuration. By default load the configuration from oauth_consumer.properties. 
  //You can also pass input stream, properties object or properties file name.
   config.load();

  //Create an instance of SocialAuthManager and set config
  SocialAuthManager manager = new SocialAuthManager();
  manager.setSocialAuthConfig(config);

  //URL of YOUR application which will be called after authentication
  String successUrl = "http://opensource.brickred.com/socialauthdemo/socialAuthSuccessAction.do";

  // get Provider URL to which you should redirect for authentication.
  // id can have values "facebook", "twitter", "yahoo" etc. or the OpenID URL
  String url = manager.getAuthenticationUrl(id, successUrl);

  // Store in session
  session.setAttribute("authManager", manager);
我的配置看起来像这样。我可以在这里用某种方式来定义它吗

#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/authorize
graph.facebook.com.access_token_url = /me
graph.facebook.com.signature_method = HMAC-SHA1
graph.facebook.com.transport_name = GET

您可以像这样添加自定义权限。

graph.facebook.com.consumer_key =   152190004803645
graph.facebook.com.consumer_secret = 64c94bd02180b0ade85889b44b2ba7c4
graph.facebook.com.custom_permission = email,user_birthday,user_location
不需要设置其他属性。但是如果您想设置其他属性,那么只有您可以设置请求\令牌\ url(对于OAuth1.0)、身份验证\ url和访问\令牌\ url。此功能可从Socialuth-4.2获得

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

是否有关于这些配置参数的文档?我在Socialuth站点上没有找到任何注释:在示例属性文件中有很多注释。注释清楚地显示了您可以执行的配置。浏览以下链接,特别阅读评论。或者,除了回答之外,您还需要在AuthManager中将权限设置为Permission.CUSTOM