Coder Social home page Coder Social logo

sahat / instagram-hackhands Goto Github PK

View Code? Open in Web Editor NEW
300.0 33.0 190.0 863 KB

Source code for HackHands blog post

Home Page: https://hackhands.com/building-instagram-clone-angularjs-satellizer-nodejs-mongodb/

License: MIT License

JavaScript 47.60% CSS 52.40%

instagram-hackhands's Issues

Add Angular using bower

This repo is awesome + the blog post is a great resource. I think it would be nice to remove the /vendor directory in favor of bower - so other could learn those best practices.

How to run the client locally

I wasn't able to get the client running on the browser. I assumed that gulp would open in (similar to grunt serve). What am I missing?

The endpoint /api/feed is not working because /users/self/feed was deprecated

Instagram was deprecated /users/self/feed.
View changelog of Nov 17, 2015.
https://www.instagram.com/developer/changelog/

This issue can be resolved consuming other instagram endpoint:

`app.get('/api/feed', isAuthenticated, function(req, res) {
var feedUrl = 'https://api.instagram.com/v1/users/self/media/recent/';
var params = { access_token: req.user.accessToken,
count : 5 };

request.get({ url: feedUrl, qs: params, json: true }, function(error, response, body) {
if (!error && response.statusCode == 200) {
res.send(body.data);
}
});
});`

Thank you.

Auth Code Flow?

Can you point me to any examples using server side or Code Flow?

What versions of Node needed?

Hello All,

I would like to run this demo, but I do not know what versions of node.js I should be using and have installed a docker container running mongodb.

Any ideas?
Thanks,

like

Hi,

When retrieving an image in response to such a variable: photo.user_has_like.
Perhaps this could be used if you already have the image liked.
Refresh page when the hasLiked variable is not updated.

Setting `currentUser` on email/password signup with automatic login after signup

tl;dr: Email/password signup with automatic login doesn't save a currentUser value and causes an error on page refresh. Can be fixed with slight change to SignupCtrl.

I used this repository and the associated tutorial to implement an email/password signup system, but noticed a problem that can be recreated as follows:

  1. A user signs up with an email and password, and then are automatically logged in and redirected to the home page;
  2. Satellizer saves the JWT to $window.localStorage on the call to its local.signup function (via the call to $auth.signup), but does not create a currentUser value in either localStorage or the $rootScope;
  3. The signed-up and automatically-logged-in user refreshes the page or closes the page and opens it again later;
  4. On reload, the run block in app.js confirms that there is an unexpired JWT saved to localStorage and attempts to access the property $window.localStorage.currentUser, which has never been set and is therefore undefined;
  5. The run block calls JSON.parse on the undefined property, which causes an Uncaught SyntaxError: Unexpected token u.

This issue can be fixed by slightly changing SignupCtrl to more-closely match the pattern used in LoginCtrl. The current signup function is:

$scope.signup = function() {
  var user = {
    email: $scope.email,
    password: $scope.password
  };

  $auth.signup(user)
    .catch(function(response) {
      console.log(response.data);
    });
};

Adding a then block after the call to $auth.signup solves the problem:

$scope.signup = function() {
  var user = {
    email: $scope.email,
    password: $scope.password
  };

  $auth.signup(user)
    .then(function(response) {
      $window.localStorage.currentUser = JSON.stringify(response.data.user);
      $rootScope.currentUser = JSON.parse($window.localStorage.currentUser);
    })

    .catch(function(response) {
      console.log(response.data);
    });
};

This way, as soon as a user is successfully signed up the value of currentUser is stored in both $window.localStorage and the $rootScope.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.