I am currently developing an app interact with word press service. And when I tried to call facebook connect in my application via word press user api, it gives error. Here is how I did:
First I connect my facebook account with permissions to get the access token. This step is success and the token is valid here. I have tried to use this token to get user profile with facebook “/me?fields=id,name,email”, it returned correct data.
mFacebookCallbackManager = CallbackManager.Factory.create();
btnFacebookSignIn.setReadPermissions("public_profile", "user_friends", "email");
btnFacebookSignIn.registerCallback(mFacebookCallbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
handleFacebookLoginSuccess();
}
@Override
public void onCancel() {
}
@Override
public void onError(FacebookException error) {
}
});
Then I use the token to connect facebook with word press service:
URL: http:///api/user/fb_connect/?access_token=
Json returned: {“status”:”ok”,”msg”:”Your ‘access_token’ did not return email of the user. Without ’email’ user can’t be logged in or registered. Get user email extended permission while joining the Facebook app.”}
==================================
Note:
-
I have included “email” permission above and can get the email field via “/me”.
-
You can see details of facebook connect in word press here https://wordpress.org/plugins/json-api-user/
Any suggestions will be appreciated. Thanks
I have found the solution of it.
In my case, I have just disable the SSL certificate in User.php file in fb_connect method.
// Enable SSL verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $enable_ssl);
change to
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
I am using the development server with prefix “http://” instead of “https://”.