omniauth-instagram 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/README.md +21 -0
- data/Rakefile +12 -0
- data/lib/omniauth-instagram.rb +2 -0
- data/lib/omniauth-instagram/version.rb +5 -0
- data/lib/omniauth/strategies/instagram.rb +35 -0
- data/omniauth-instagram.gemspec +24 -0
- data/spec/omniauth/strategies/instagram_spec.rb +7 -0
- data/spec/spec_helper.rb +16 -0
- metadata +123 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# OmniAuth Instagram
|
2
|
+
|
3
|
+
This is the unofficial OmniAuth strategy for authenticating to Instagram. To
|
4
|
+
use it, you'll need to sign up for an OAuth2 Application ID and Secret
|
5
|
+
on the [Instagram Developer website](http://instagram.com/developer/).
|
6
|
+
|
7
|
+
## Basic Usage
|
8
|
+
|
9
|
+
use OmniAuth::Builder do
|
10
|
+
provider :instagram, ENV['INSTAGRAM_ID'], ENV['INSTAGRAM_SECRET']
|
11
|
+
end
|
12
|
+
|
13
|
+
## License
|
14
|
+
|
15
|
+
Copyright (c) 2011 Mihai Anca and Intridea, Inc.
|
16
|
+
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
18
|
+
|
19
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
20
|
+
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Instagram < OmniAuth::Strategies::OAuth2
|
6
|
+
option :client_options, {
|
7
|
+
:site => 'https://api.instagram.com',
|
8
|
+
:authorize_url => 'https://api.instagram.com/oauth/authorize',
|
9
|
+
:token_url => 'https://api.instagram.com/oauth/access_token'
|
10
|
+
}
|
11
|
+
|
12
|
+
def request_phase
|
13
|
+
options[:scope] ||= 'basic'
|
14
|
+
options[:response_type] ||= 'code'
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
uid { raw_info['id'] }
|
19
|
+
|
20
|
+
info do
|
21
|
+
{
|
22
|
+
'nickname' => raw_info['username'],
|
23
|
+
'name' => raw_info['full_name'],
|
24
|
+
'image' => raw_info['profile_picture'],
|
25
|
+
'bio' => raw_info['bio'],
|
26
|
+
'website' => raw_info['website'],
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
def raw_info
|
31
|
+
@data ||= access_token.params["user"]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-instagram/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Mihai Anca"]
|
6
|
+
gem.email = ["mihai@mihaia.com"]
|
7
|
+
gem.description = %q{OmniAuth strategy for Instagram.}
|
8
|
+
gem.summary = %q{OmniAuth strategy for Instagram.}
|
9
|
+
gem.homepage = "https://github.com/ropiku/omniauth-instagram"
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "omniauth-instagram"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = OmniAuth::Instagram::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency 'omniauth', '~> 1.0'
|
19
|
+
gem.add_dependency 'omniauth-oauth2', '~> 1.0'
|
20
|
+
gem.add_development_dependency 'rspec', '~> 2.7'
|
21
|
+
gem.add_development_dependency 'rack-test'
|
22
|
+
gem.add_development_dependency 'simplecov'
|
23
|
+
gem.add_development_dependency 'webmock'
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start
|
5
|
+
require 'rspec'
|
6
|
+
require 'rack/test'
|
7
|
+
require 'webmock/rspec'
|
8
|
+
require 'omniauth'
|
9
|
+
require 'omniauth-instagram'
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.include WebMock::API
|
13
|
+
config.include Rack::Test::Methods
|
14
|
+
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
15
|
+
end
|
16
|
+
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-instagram
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Mihai Anca
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-11-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth
|
16
|
+
requirement: &70124770943760 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70124770943760
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: omniauth-oauth2
|
27
|
+
requirement: &70124770943240 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70124770943240
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &70124770942740 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '2.7'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70124770942740
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rack-test
|
49
|
+
requirement: &70124770942300 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70124770942300
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: simplecov
|
60
|
+
requirement: &70124770941820 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70124770941820
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: &70124770941320 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70124770941320
|
80
|
+
description: OmniAuth strategy for Instagram.
|
81
|
+
email:
|
82
|
+
- mihai@mihaia.com
|
83
|
+
executables: []
|
84
|
+
extensions: []
|
85
|
+
extra_rdoc_files: []
|
86
|
+
files:
|
87
|
+
- .gitignore
|
88
|
+
- Gemfile
|
89
|
+
- README.md
|
90
|
+
- Rakefile
|
91
|
+
- lib/omniauth-instagram.rb
|
92
|
+
- lib/omniauth-instagram/version.rb
|
93
|
+
- lib/omniauth/strategies/instagram.rb
|
94
|
+
- omniauth-instagram.gemspec
|
95
|
+
- spec/omniauth/strategies/instagram_spec.rb
|
96
|
+
- spec/spec_helper.rb
|
97
|
+
homepage: https://github.com/ropiku/omniauth-instagram
|
98
|
+
licenses: []
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ! '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
requirements: []
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 1.8.10
|
118
|
+
signing_key:
|
119
|
+
specification_version: 3
|
120
|
+
summary: OmniAuth strategy for Instagram.
|
121
|
+
test_files:
|
122
|
+
- spec/omniauth/strategies/instagram_spec.rb
|
123
|
+
- spec/spec_helper.rb
|