API Error Code 102 : javascript dialogs with php

2019-09-15 08:20发布

问题:

API Error Code: 102 API Error Description: Session key invalid or no longer valid Error Message: Iframe dialogs must be called with a session key

I get this funny message when calling a fb dialog to post to a friends wall in my new app. The same code is working for other apps. This suddenly stopped working. When i specifically dont set iframe, a weird pop up now pops up now. As browsers block pop ups it doesnt turn up.

Also auto posting directly is not working even when user permits. My app is not unresricted also. Any one has any idea ??

回答1:

I've had this error, when calling dialog without user interaction. For example when both 'document ready' and 'FB js-sdk loaded events' are fired. When i called the dialog with same function, parameters, on same page but in reaction on user mouse click - it worked.

If this is similiar to what you have, here is the solution:

FB.getLoginStatus(function(response) {
    if (response.authResponse) {
        //call dialog here
    }
});