这是我的代码,如何使用 oauth 获取 user_id 或用户的名字和姓氏等数据并将它们签名到字段?我应该在 onSuccess 方法中实现它们吗?
private void addFacebookAuth(){
loginButton.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
final AuthRequest req = new AuthRequest(FACEBOOK_AUTH_URL, FACEBOOK_APP_ID).withScopes(
FACEBOOK_EMAIL_SCOPE,
FACEBOOK_BIRTHDAY_SCOPE,
FACEBOOK_USERID_SCOPE,
FACEBOOK_USER_LAST_NAME_SCOPE,
FACEBOOK_USER_FIRST_NAME_SCOPE).withScopeDelimiter(",");
AUTH.login(req, new Callback<String, Throwable>(){
@Override
public void onFailure(Throwable reason) {
Window.alert("Error:\n" + reason.getMessage());
}
@Override
public void onSuccess(String token) {
// Window.alert("Got an OAuth token:\n" + token + "\n"
// + "Token expires in " + AUTH.expiresIn(req) + " ms\n");
RootPanel.get().remove(loginButton);
}
});
}
});
RootPanel.get().add(loginButton);
}