Project

igm

0.0
No commit activity in last 3 years
No release in over 3 years
Interacts with Instagram's API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.0

Runtime

 Project Readme

IGM

You can use this library to implement Instagram login in your Ruby application.

We use this at Chicisimo.

Usage

require "sinatra"
require "igm"

REDIRECT_URI = "https://something.com/login/instagram/token"

IGM.configure do |config|
  config.client_id     = "xxx"
  config.client_secret = "xxx"
end

get "/login/instagram" do
  redirect to(IGM.authorize_uri(redirect_uri: REDIRECT_URI, scope: %w{basic}))
end

get "/login/instagram/token" do
  code = params[:code]

  access_token = IGM.get_access_token(redirect_uri: REDIRECT_URI, code: code) # => "51116472.c3144az.2s1ce1c0074u4918aad3454263e4fe6c"

  user = IGM.get_user_info(access_token) # => {:username=>"pedrotgimenez", :bio=>"autodidact. I write software at @chicisimo.", :website=>"https://twitter.com/pedrotgimenez", :profile_picture=>"https://igcdn-photos-d-a.akamaihd.net/hphotos-ak-xap1/t51.2885-19/11191353_1624249301122731_1724880273_a.jpg", :full_name=>"Pedro Giménez", :counts=>{:media=>65, :followed_by=>1, :follows=>1}, :id=>"xxxx"}
end