Sunday, March 6, 2022

[FIXED] Publish on Facebook to a app user with out login?

Issue

I've read a lot and this is the only solution I get to:

  1. The first time the user logs in the app (with publish-actions) you get the token
  2. Convert the token to Long-Lived Token
  3. You can use it to publish for the next 2 months
  4. If the user clicks on a post you send, the token is reset to another 2 months

Am I right? Is that the best solution?


Solution

all correct. I am not sure about the user click (didn't find that in the documentation https://developers.facebook.com/docs/facebook-login/access-tokens). You should be ready to handle errors in case the token expires earlier or in case of app uninstalls. I check if the token is still valid by getting the user basic info with the access token I have. If the call is successful, I use the token. If not, I redirect the user app authorization again, get another token, exchange it with another long-lived token, and use that one.



Answered By - tattvamasi

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.