我已经尝试过这个,但我的模块文件夹中没有Facebook!! 我已经安装了FBconnect 0.6和FBGRAPH。但是我的IDE显示错误,告诉我找不到"play.modules.facebook.FbGraph"。
项目成员 erja...@gmail.com 的评论,2011年5月16日
// [...]
import play.modules.facebook.FbGraph;
import play.modules.facebook.FbGraphException;
import play.modules.facebook.Parameter;
// [...]
public class Application extends Controller {
// [...]
public static void facebookLogin() {
try {
JsonObject profile = FbGraph.getObject("me"); // fetch the logged in user
String email = profile.get("email").getAsString(); // retrieve the email
// do useful things
Session.current().put("username", email); // put the email into the session (for the Secure module)
} catch (FbGraphException fbge) {
flash.error(fbge.getMessage());
if (fbge.getType() != null && fbge.getType().equals("OAuthException")) {
Session.current().remove("username");
}
}
redirect("/");
}
}
请帮帮我!!
如果您还没有这样做,请尝试以下操作:
- 将模块添加到依赖项.yml
- 播放 deps --同步
- 播放日食
- 在 Eclipse 中删除并重新导入