[英]ParsefacebookUtils returning wrong values in Parse
for my android application i wanted to integrate a facebook login, so i did exactly what is here: 对于我的Android应用程序,我想集成一个Facebook登录名,所以我确实在这里做了什么:
https://github.com/ParsePlatform/IntegratingFacebookTutorial https://github.com/ParsePlatform/IntegratingFacebookTutorial
Everything seems to work fine however the values which are stored in the parse backend are not convenient, here is for example what i get after login with my facebook account: emailVerified:empty 一切似乎都可以正常工作,但是存储在解析后端中的值并不方便,例如,这是我使用Facebook帐户登录后得到的信息:emailVerified:empty
username:adGdJMxcCQCAo2..... 用户名:adGdJMxcCQCAo2 .....
authData: {"facebook":{"access_token":"CAAMBDxU3HgUBAMYQ8q2mnjDqeKBz2sw......","expiration_date":"...","id":"1015353..."}} authData:{“ facebook”:{“ access_token”:“ CAAMBDxU3HgUBAMYQ8q2mnjDqeKBz2sw ......”,“ expiration_date”:“ ...”,“ id”:“ 1015353 ...”}}
Sorry i still can't upload pictures.. Is this normal? 抱歉,我仍然无法上传图片。这正常吗?
i'm using parseFacebookUtils 1.9.4 parse 1.9.4 我正在使用parseFacebookUtils 1.9.4 parse 1.9.4
This is what i had done for facebook
parse.com
login 这是我为facebook
parse.com
登录所做的
LoginFragment.java LoginFragment.java
private ParseLoginConfig config;
@Override
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState, 1);
rootView = inflater.inflate(R.layout.layout_login, container, false);
config = ParseLoginConfig.fromBundle(getArguments(), getActivity());
return rootView;
}
private void loginUsingFacebook() {
// TODO Auto-generated method stub
if (config.isFacebookLoginNeedPublishPermissions()) {
ParseFacebookUtils.logInWithPublishPermissionsInBackground(
getActivity(), Arrays.asList("public_profile", "email"),
facebookLoginCallbackV4);
} else {
ParseFacebookUtils.logInWithReadPermissionsInBackground(
getActivity(), Arrays.asList("public_profile", "email"),
facebookLoginCallbackV4);
}
}
private LogInCallback facebookLoginCallbackV4 = new LogInCallback() {
@Override
public void done(ParseUser user, ParseException e) {
if (isActivityDestroyed()) {
return;
}
if (user == null) {
loadingFinish();
if (e != null) {
showToast(R.string.com_parse_ui_facebook_login_failed_toast);
debugLog(getString(R.string.com_parse_ui_login_warning_facebook_login_failed)
+ e.toString());
}
} else if (user.isNew()) {
GraphRequest.newMeRequest(AccessToken.getCurrentAccessToken(),
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(JSONObject fbUser,
GraphResponse response) {
/*
* If we were able to successfully retrieve the
* Facebook user's name, let's set it on the
* fullName field.
*/
Log.e("facebook User", fbUser.toString());
final ParseUser parseUser = ParseUser
.getCurrentUser();
if (fbUser != null
&& parseUser != null
&& fbUser.optString("name").length() > 0) {
parseUser.put(USER_OBJECT_NAME_FIELD,
fbUser.optString("name"));
parseUser.put(USER_OBJECT_EMAIL_FIELD,
fbUser.optString("email"));
parseUser
.saveInBackground(new SaveCallback() {
@Override
public void done(
ParseException e) {
if (e != null) {
debugLog(getString(R.string.com_parse_ui_login_warning_facebook_login_user_update_failed)
+ e.toString());
}
ParseInstallation installation = ParseInstallation
.getCurrentInstallation();
installation
.put(BaseFragment.INSTALLATION_UNIQUE_ID,
parseUser
.getUsername());
installation
.saveInBackground();
loginSuccess();
}
});
}
}
}).executeAsync();
}
}
};
Note : Remove toast messages and and text me if any query!! 注意: 删除多士消息,如有任何查询,请给我发短信!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.