我正在尝试使用以下代码访问我的Facebook应用程序:
btnNewButton.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
String domain = "http://www.google.com/";
String appId = "524606967732411";
String authUrl ="https://graph.facebook.com/oauth/authorize?type=user_agent&clientid="+appId+"&redirect_url="+domain+"&scope=user_about_me,";/*
+"user_actions.books,user_actions.music,user_actions.news,user_actions.videos,user_activities,user_birthday,user_education_history"
+"user_events,user_photos,user_friends,user_games_avtivity,user_groups,user_hometown,user_interests,user_likes,user_location,user_photos,user_relationship_details,"
+"user_relationships,user_religion_politics,user_status,user_tagged_places,user_videos,user_website,user_work_history,ads_management,ads_read,email,"
+"manage_notifications,manage_pages,publish_actions,read_friendlists,read_insights,read_mailbox,read_page_mailboxes,read_stream,ravp_event,fo";*/
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get(authUrl);
String accessToken;
while(true){
if(!driver.getCurrentUrl().contains("facebook.com")){
String url = driver.getCurrentUrl();
accessToken = url.replaceAll(".*#access_token=(.+)&.*", "$l");
driver.quit();
FacebookClient fbClient = new DefaultFacebookClient(accessToken);
User me = fbClient.fetchObject("me", User.class);
}
}
}
});
chorme正在打开,但它显示此消息错误:
{
"error": {
"message": "Missing redirect_uri parameter.",
"type": "OAuthException",
"code": 191,
"fbtrace_id": "E0YDbab1wzS"
}
}
在控制台屏幕上显示以下消息:
我希望有人可以提供帮助!
先谢谢你了!
答案 0 :(得分:0)
我注意到您指定redirect_url
而不是redirect_uri
希望有所帮助
也许这是多余的,但错误信息恰恰说明了:)