Last active
August 29, 2015 14:16
-
-
Save gotoAndBliss/bf97feda35b776221fda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# STEP 1 : http://instagram.com/developer. Login to your account. Then click on Manage Clients, and finally on Register a New Client | |
# STEP 2 : Fill out the required fields for registering a new client id making sure to set the OAuth redirect_uri field to "http://localhost" (without quotes). | |
# The reason you should use localhost is for security. In computer networking localhost is the web address of the computer you are using. So when Instagram redirects to your redirect_uri, all of your sensitive information is passed from Instagram's servers directly to your computer. See wikipedia.org/wiki/Localhost for more details. | |
# STEP 2 and a HALF : IN your GEMFILE Add : | |
gem "instagram" | |
# STEP 3 : Make a file /config/initializers/instagram.rb | |
require "instagram" | |
Instagram.configure do |config| | |
config.client_id = CLIENT_ID | |
config.client_secret = CLIENT_SECRET | |
end | |
# GET YOUR F'N CODE TOKEN BY GOING TO THIS IN A BROWSER! | |
# 1. https://instagram.com/oauth/authorize/?client_id=YOUR_CLIENT_ID&redirect_uri=http://localhost&response_type=code&scope=likes+comments+relationships+basic | |
# IN YOUR CONSOLE DO THIS : | |
# 2. Instagram.get_access_token(params[:code], :redirect_uri => "http://localhost") # GET THE ACESS_TOKEN! | |
# 3. client = Instagram.client(access_token: ENV['access_token'], client_id: ENV['client_id'], client_secret: ENV['client_secret'], client_ips: '127.0.0.1') | |
# results = client.tag_recent_media("yoga") | |
# results.each{|r|client.like_media(r.id)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment