• Resolved ycv005

    (@ycv005)


    Hello, I was implementing Facebook Oauth on a mobile app using rest API along with your plugin. Also, I have read other post related to REST API(its Flow, data format, and possible error). I am here because I have tried all mean using POSTMAN client(3 different ways).

    Note- I can successfully login on my website using Fb Oauth with help of your plugin. Also, I have a different app on FB developer, one for mobile app and one for the website.

    1st way- Screenshot- https://prnt.sc/sv5t39 . This Token I have obtained via my app and tried in post man. Getting below Error

    2nd way- Screenshot- https://prnt.sc/sv5tkf. I know this was not correct way, but still I have tried it, sending data into body.

    3rd way- Screenshot- https://prnt.sc/sv5rjv . This Token I have obtain via the website using this echo wp_remote_retrieve_body($request);exit; in file wp-content/plugins/social-login/nextend-facebook-connect/includes/oauth2.php near line 138. Here, I am sending all data as the paramater as told by you, and I am getting below error (500 Internal Error)

    {
    “code”: “error”,
    “message”: “An active access token must be used to query information about the current user.”,
    “data”: null
    }

    Could you tell me what I am missing exactly, Even I am getting Token via website which has come from nextend, still facing problem. Thanks in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Laszlo

    (@laszloszalvak)

    Hi @ycv005

    In your screenshot I see the problem is actually related to the way the access token was posted to the REST API endpoint of the NSL – Facebook provider.
    The post parameter key should be called:

    • access_token

    and its value should be the JSON encoded access token in a format like:

    • {“access_token”:”*************”,”token_type”:”bearer”,”expires_in”:5183946}

    So the access token is the entire JSON encoded string.

    Note: Since we received a lot of REST API related questions recently, we created a documentation that helps developers in using our REST API:

    In this documentation you will find some examples for the way you should post the token to our REST API, in PHP cURL and Postman as well.
    Also you will find the endpoint and the format of the access token for each provider.

    Best regards,
    Laszlo.

    Thread Starter ycv005

    (@ycv005)

    Thanks. Great work. Going to apply and tell you back.

    Thread Starter ycv005

    (@ycv005)

    Hello, First of thanks for your effort. I have tried the above-mentioned method and it seems to work.

    1- Token I got from the website (using echo command you told), and when I am posting via postman, I am getting HTTP response- 200 OK but the body is null. Screenshot

    2- Since, my app and website has different app on facebook(unable to create a single app for both as no option given). The Auth token which I got from my app is working correctly (cross- checked via facebook token debugger) but when I am posting to website via post man, I am getting error-

    
    {
        "code": "error",
        "message": "Invalid appsecret_proof provided in the API argument",
        "data": null
    }
    

    Screenshot

    Also, I have tried associate my app on fb dev but that didn’t work.

    Could you please give me some directions. Thanks in advance.

    Plugin Support Laszlo

    (@laszloszalvak)

    Hi @ycv005

    Your error message indicates that your current access token comes from an App other then the one you configured Nextend Social Login with.

    Nextend Social Login ( NSL ) doesn’t have a support for multiple Facebook Apps. Both NSL and its REST API endpoints will always use the App that you configured the provider with.

    Actually there are multiple problems with using different Facebook Apps, since in each Facebook App the same user will have different social ID-s.
    We are identifying the corresponding WordPress account according to the link between the WordPress user ID and the social ID.
    According to the documentation you found: https://developers.facebook.com/docs/facebook-login/connecting-accounts/
    you could probably create a workaround to get the user’s social ID in your second App, by passing the access token and appsecret proof of your first app, however this will only work if the user authorized both of your Facebook Apps.

    E.g.: if somehow a user would register with your mobile App, you are not able to get the social ID associated with the desktop app, since the user never granted permissions for that App.

    Best regards,
    Laszlo.

    Thread Starter ycv005

    (@ycv005)

    Ya, as I mentioned earlier, I have different apps for both web and app separately (but both are related to the same account, I know this won’t matter just telling).

    So, could you tell me the solution or approach to how to solve it? because I am unable to create the same app for both. Thanks in advance.

    Plugin Support Laszlo

    (@laszloszalvak)

    Hi @ycv005

    I am sorry, but as I mentioned above we don’t support multiple Apps, and because of the reasons I mentioned above it is not possible.

    Anyways you can add multiple platforms to the same App:

    so actually you could use the same App for Web, Android and iOS.

    Thread Starter ycv005

    (@ycv005)

    Ya, this is what I was looking for, let me apply this. Thanks for the directions.

    Thread Starter ycv005

    (@ycv005)

    Thanks buddy for all your effort. Fb auth working now on App as well web.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Facebook Oauth Rest Api Error’ is closed to new replies.