Post Facebook Status Via Laravel App
I want to allow my users to post their status to facebook via my site.
I'm new to all of this facebook integration. I did some research on it, and I found so much packages, and information about it. It's overwhelming, and not sure which one I should start using.
How would one go about and implement something like this ?
This is not really related to Laravel, but I will give you a list of steps involved:
Register your Facebook app on Facebook Developers to obtain app key and secret.
Add a Facebook authorisation page/button somewhere on your website – you need to redirect users to Facebook and ask for permissions to write on their behalf. This is pretty straight forward and there is a big amount of packages available. This one is pretty simple for instance: https://github.com/adamwathan/eloquent-oauth
Once permission is granted, you have to store OAuth secret token somewhere in your application (usually database). If you use the package mentioned above, your tokens will be stored in 'oauth_identities' table of the database.
Whenever the moment that you want to post something arrives, use Facebook PHP SDK (there are some Laravel wrappers, for instance: https://github.com/SammyK/LaravelFacebookSdk) to post a status update using users token.
If you don't plan any extended functionality, you may actually skip Facebook SDK and make simple HTTP POST requests to graph.facebook.com, method is POST and path is '/me/feed', you submit a form variable called 'message' – very simple!
- Note that access tokens expire so you need to extend them from time to time.
- → Import statement and Babel
- → Getting Comments of comments Facebook API
- → Facebook Developer API in reactjs code
- → Facebook PHP SDK - Graph Error "Authorization code has been used" on page refresh
- → How is possible to open website inside facebook mobile app like buzzfeed?
- → Laravel - set meta tag dynamically with @section
- → Do Flux (by Facebook) handle server side update with sockets
- → understanding of real example open graph protocol
- → flynsarmy-sociallogin (Facebook api) in octoberCMS - Authentication failed! Facebook returned an invalid user id
- → Open Graph data facebook
- → Putting Facebook photos on canvas, taint canvas when trying to send it toDataURL. Can I set Facebook's header for CORS?
- → OctoberCMS plugin SEO Meta Og image
- → Shopify + og:image resulting in "was not a valid URL."