Plugin Support
Laszlo
(@laszloszalvak)
Hi @shukindigo
If the access token is actually fine, then I assume your problem will be related to the format you post it.
I am not really sure but you are probably posting only the “access_token” value, but no the whole JSON encoded access token as I suggested here:
https://ww.wp.xz.cn/support/topic/rest-api-social-login-work-flow/#post-12026347
If this is the problem, then please make sure, you JSON encode the whole access token what the provider returns, so it should look something like:
{"access_token":"xxxxxxxxx","token_type":"bearer","expires_in":5183946}
Here you can see an example for both the Facebook and Google access_token: https://gist.github.com/nextend/b733d402ee2e2cee59b632f6e4741a9d
Best regards,
Laszlo.
Hi.
I did actually posted the whole parameters in the json.
Also, I’ve tested with your test-form where there is text field for access token, still the problem persist. I got the same error.
Is it something to do with any other setup?
My wordpress is located in a subdirectory, could it be a cause?
Plugin Support
Laszlo
(@laszloszalvak)
Hi @shukindigo
WordPress installations in subfolders should not cause such problem.
But I assume something isn’t quite right with your access token. I just checked the test form, with the JSON encoded access_token token of the Facebook provider and the form worked fine for me, when there was a user registered with the posted access_token it returned the User ID fine.
What I would suggest you to:
1.) Login to your test Facebook account, go to Settings > Apps and Websites > find the App you are testing with then Remove it. This will revoke your access_token.
2.) Once it is done, go to your WordPress site, delete the test WordPress account that your test Facebook account is linked with. ( This is just to make sure, your test WordPress account is not linked with a Facebook account over another Facebook App. )
3.) Then you should register a new WordPress account with your Facebook account.
4.) After that log out of the WordPress account.
5.) Open this file:
- wp-content/plugins/nextend-facebook-connect/includes/oauth2.php
find this code:
$this->access_token_data = $accessTokenData;
in the authenticate() function around line 144 and add this code after it:
echo wp_json_encode($this->access_token_data);exit;
6.) Try to connect with the Facebook provider again. It will write out your access token.
7.) Copy this access token and test it with the REST API test form.
8.) If this works fine, then compare the structure of the working access token with the wrong access token.
9.) Don’t forget to remove the custom code that writes out the access token, once you finished the debugging!
Anyway please note that we can not provide support for problems related to custom coding, but hopefully this will help you in solving the problem.
Best regards,
Laszlo.