How do I renew a Facebook user_access_token if I deal with a lot of AJAX?

后端 未结 7 1079

Please tell me if I\'m understanding correctly. (because I might not be.)

  1. User posts something on my site. (He checked \"also post to Facebook\".)
  2. Client
7条回答
  •  后悔当初
    2021-02-09 13:32

    The idea is to make use of the Facebook JS-SDK methods:

    1. User check the Post To Facebook option
    2. you check if the current user is connected to your app (using FB.getLoginStatus())
    3. if the user is connected, you have two options:
      • post directly using the FB.api method or
      • Send the access_token to your server to complete the post process there
    4. if the user is not connected (or not logged in to Facebook), use the FB.login() method

    Here's a quick example (with a Live Demo!) for you to get started:

    
    
    
    


提交回复
热议问题