A demo of a simple app that uses the Instagram gem
This app demonstrates fetching several users' recent feeds, organizing each user's images by their most popular hashtags, and displaying the images in a simple gallery.
-
Set up the configuration file
cp config/application.example.yml secrets/application.yml
-
Edit
application.yml
to reflect the appropriate Instagram configuration values for your app, specifically, theclient_id
,client_secret
, andaccess_token
. See steps below for steps for obtaining these. -
Run these commands to try it out
bundle rake db:setup rails s
-
Register your app with Instagram - this will provide you with your
client_id
,client_secret
, andredirect_url
-
Generate an authorization code:
https://instagram.com/oauth/authorize/? client_id=your_client_id& redirect_uri=your_redirect_url& response_type=code
-
Generate an access token:
curl \-F 'client_id=your_client_id' \ -F 'client_secret=your_client_secret' \ -F 'grant_type=authorization_code' \ -F 'redirect_uri=your_redirect_url' \ -F 'code=your_code' \https://api.instagram.com/oauth/access_token