An Active Access Token Must Be Used To Query Information

Support » Plugin: Nextend Social Login and Register » An active access token must be used to query information


Resolved
*
shukindigo

(

Hello.I have followed the steps that you have provided in the first reply found here : https://nayaritas.net/support/topic/rest-api-social-login-work-flow/

However I am getting the following error for facebook login:

An active access token must be used to query information about the current user.

Bạn đang xem: An active access token must be used to query information

I have checked the access token via https://graph.facebook.com/me?access_token=xxxxxxxxx and I got the name and ID information.

Using other test access tokens (obtained via fb dev access token tool) also returned the aforementioned error.

I have even tested via your test form found here : https://gist.github.com/nextend/4d3c701c8d99972824025e4dfdeccac0 and again, it returned the same error.

Please help me on this.


Viewing 3 replies - 1 through 3 (of 3 total)
Plugin Support
*
Laszlo

(
laszloszalvak)


1 year, 3 months ago


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://nayaritas.net/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.

Xem thêm: 3 Cách Kiểm Tra Card Đồ Họa Máy Tính Có Card Đồ Họa Hay Chưa?


Thread Starter
*
shukindigo

(
shukindigo)


1 year, 3 months ago


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 nayaritas.net is located in a subdirectory, could it be a cause?


Plugin Support
*
Laszlo

(
laszloszalvak)


1 year, 3 months ago


Hi
shukindigo

nayaritas.net 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 nayaritas.net site, delete the test nayaritas.net account that your test Facebook account is linked with. ( This is just to make sure, your test nayaritas.net account is not linked with a Facebook account over another Facebook App. )3.) Then you should register a new nayaritas.net account with your Facebook account.4.) After that log out of the nayaritas.net 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.