These are chat archives for pavelk2/social-feed

24th
Nov 2015
Pavel Kucherbaev
@pavelk2
Nov 24 2015 15:01
#142 - is a real issue we need to solve it. @/all
Pavel Kucherbaev
@pavelk2
Nov 24 2015 15:55

Once upon a time we had one guy helping out with Social-feed and he was looking for issues to contribute. I would like to share with you guys here things to consider next to implement:

Dependencies

Currently we have bower_components in the repository itself - i believe it is a bad practice. We can clean them up, make a new release, update https://github.com/pavelk2/social-feed/blob/gh-pages/bower.json file (so it cites the latest release). In this case the code will work, but it will not be possible to use it as an example via github pages. We can create another repository (social-feed-example), where we define the logic of downloading all the dependencies and we deploy it on Heroku (for free). So social-feed is only for the plugin itself, social-feed-example uses social-feed via bower to make example. Social-feed-server is an optional tool which can also be easily deployed on Heroku.

Server side

I have created a simple server-side app (you can deploy it easily on Heroku via a deploy button).
here is an example how you use it:
https://social-feed-server.herokuapp.com/facebook?url=https%3A%2F%2Fgraph.facebook.com%2Fv2.4%2F18790602800%2Fposts%3Ffields%3Did%2Cfrom%2Cname%2Cmessage%2Ccreated_time%2Cstory%2Cdescription%2Clink%2Cpicture%2Cobject_id%26limit%3D2

So what we can do: for each social network in social-feed we can add an option "server-proxy-url", which is false by default, which means that all the requests go as they go now - directly to the social networks. Otherwise - we can define a url of the app to send request, like "https://social-feed-server.herokuapp.com/" and inside to define the appropriate logic. If you use the social-feed-server app - there is no need to specify access_tokens as, they are added later in the app itself. Also omit adding callback? in the end of your urls for social-feed-server.

Code cleaning

You can use https://codeclimate.com/ to validate the code on social-feed and fix issues if any.

Yordi Pauptit
@yp28
Nov 24 2015 15:57
@pavelk2, I'm sorry man, I'm too busy with other things to contribute to this project at this point in time. If you like, you can remove me as a collaborator.
Brett Dorrans
@brettdorrans
Nov 24 2015 17:11
Hello Pavel - thanks for the invitation to collaborate. Time permitting I may look at the Instagram issue and if I can resolve it I'll submit a pull request. The problem is not just in the code (I suspect it'd be a relatively trivial fix on that front), but on how Instagram now requiring two factor authentication for all API requests - we now need to go through an OAuth authentication flow - pass client_id to Instagram, have the user log in and authorise the app, which will then return an access_token as a URL fragment. Getting this URL fragment is a bit of a hassle using Javascript alone (it's a bit easier with server side code, since we can include the client_secret there). I think it's do-able but Instagram has made it a bit difficult!
Brett Dorrans
@brettdorrans
Nov 24 2015 17:25
One of the issues I had while debugging was a lack of transparent error logging - I had to manually inspect the json return from the server to identify the error code the Instagram API was returning, it may be a good idea to have a debug setting that catches API errors/any requests that don't return 200 OK
Pavel Kucherbaev
@pavelk2
Nov 24 2015 19:18
@YP28 Thank you anyway for all your help!
@brettdorrans I am not sure we need to do this auth process. This is what Instagram API states:
The Instagram API requires authentication - specifically requests made on behalf of a user. Authenticated requests require an access_token. These tokens are unique to a user and should be stored securely. Access tokens may expire at any time in the future.
We do not do any actions on behalf of users - so I believe we don't really need it.
Pavel Kucherbaev
@pavelk2
Nov 24 2015 19:27
@brettdorrans the names of Instagram users sometimes were not shown because full-names sometimes are not present. I submitted a fix pavelk2/social-feed@2e79b68
Pavel Kucherbaev
@pavelk2
Nov 24 2015 19:33
@brettdorrans good idea about the error catching.
We might use bugsnags - to catch javascript errors.
Still I would suggest that we first split the project into pure plugin and implementation example (where later we add bugsnag). Otherwise we add bugsnag right to the plugin which is not acceptable.
Please give a look to the list of things for implementation above here in chat. let me know if you are interested in implementing something specific.
Pavel Kucherbaev
@pavelk2
Nov 24 2015 19:46
@brettdorrans I analyze now what you stated in #142
Pavel Kucherbaev
@pavelk2
Nov 24 2015 20:03
@brettdorrans you are right. We could ask people to visit the url https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=code to get their Access_code to be injected into the plugin
Guillaume K.
@Webarkitekt
Nov 24 2015 21:03
i was thinking the same thing about the error catching
Brett Dorrans
@brettdorrans
Nov 24 2015 21:23
@pavelk2 yes, adding instructions along those lines to the readme would be useful once the Instagram API issue is resolved