简体   繁体   中英

How to post to user's wall when user is offline

I have just used the javascript sdk to publish to the wall when the user is online.

I am starting to like it. Now I want to post to wall when user is offline. I already have extended permissions from the user.

How can I post to user's wall when user is offline using javascript sdk.

here is my code:

function Publish(body){
        FB.api('/me/feed', 'post', { message: body }, function(response) {
            if (!response || response.error) {
                 alert('Error occured');
            } else {
                 alert('Post ID: ' + response.id);
            }
       });
 }

I appreciate any help.

Thanks.

That's only possible when user permits you. In other words, you need offline_access extended permission from user and only after that you can do that.

I'm not 100% sure of this, but I don't believe you can accomplish this with only the JavaScript API.

Just getting the user to accept the permissions isn't enough - that doesn't make all your API calls "automagically" work. As mentioned in item #3 here , you are given an access_token that is to be used in future API calls on behalf of the user.

And so enters the problem with the offline_access permission. If using JavaScript only - where are you going to store the access token that grants offline access so that you may use it when the user is not at their computer?

If even you figured out how to store it and retrieve it for later use, I'm not sure if you can even use the JavaScript SDK to make API calls for a non-session user.

据我了解,您仅需要'publish_stream'权限- 如果我请求publish_stream,请选中是否需要“ offline_access”权限?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM