omniauth-snapchat 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +46 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/lib/omniauth-snapchat.rb +2 -0
- data/lib/omniauth/snapchat/version.rb +5 -0
- data/lib/omniauth/strategies/snapchat.rb +52 -0
- data/omniauth-snapchat.gemspec +19 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a57dd4fe9eeb1022c44b0c65ae2c934d19feb32f850fa161a854a26093aae7ad
|
4
|
+
data.tar.gz: 51ed699e8ed3a17f05943cf847b64544f0735147a711f020f00a70603fbee5b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 78a56b52ad4b5bad8295189dcf2ed07bfd59353f3148bc6f9f50d8b4ed47a230cb4f8899876aebfb15d6ba85f5814da1ba19ef699039f22240e21c66c36fb896
|
7
|
+
data.tar.gz: 39b1826b3234afe3b15cb5dfa66b33d64443b0ac198e97eee667932ab1bb6f3b6c0bc3c6f531a03dbfdf4edfccf55364c86579e588fca3c044a4a66fbbb0c9b5
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omniauth-snapchat (0.1.0)
|
5
|
+
omniauth-oauth2 (~> 1.6)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
faraday (1.3.0)
|
11
|
+
faraday-net_http (~> 1.0)
|
12
|
+
multipart-post (>= 1.2, < 3)
|
13
|
+
ruby2_keywords
|
14
|
+
faraday-net_http (1.0.1)
|
15
|
+
hashie (4.1.0)
|
16
|
+
jwt (2.2.2)
|
17
|
+
multi_json (1.15.0)
|
18
|
+
multi_xml (0.6.0)
|
19
|
+
multipart-post (2.1.1)
|
20
|
+
oauth2 (1.4.4)
|
21
|
+
faraday (>= 0.8, < 2.0)
|
22
|
+
jwt (>= 1.0, < 3.0)
|
23
|
+
multi_json (~> 1.3)
|
24
|
+
multi_xml (~> 0.5)
|
25
|
+
rack (>= 1.2, < 3)
|
26
|
+
omniauth (2.0.1)
|
27
|
+
hashie (>= 3.4.6)
|
28
|
+
rack (>= 1.6.2, < 3)
|
29
|
+
rack-protection
|
30
|
+
omniauth-oauth2 (1.7.1)
|
31
|
+
oauth2 (~> 1.4)
|
32
|
+
omniauth (>= 1.9, < 3)
|
33
|
+
rack (2.2.3)
|
34
|
+
rack-protection (2.1.0)
|
35
|
+
rack
|
36
|
+
ruby2_keywords (0.0.2)
|
37
|
+
|
38
|
+
PLATFORMS
|
39
|
+
ruby
|
40
|
+
|
41
|
+
DEPENDENCIES
|
42
|
+
bundler (~> 1.16)
|
43
|
+
omniauth-snapchat!
|
44
|
+
|
45
|
+
BUNDLED WITH
|
46
|
+
1.17.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Van Pham
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Omniauth::Snapchat
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/omniauth/snapchat`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'omniauth-snapchat'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install omniauth-snapchat
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/omniauth-snapchat. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the Omniauth::Snapchat project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/omniauth-snapchat/blob/master/CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'omniauth/strategies/oauth2'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class Snapchat < OmniAuth::Strategies::OAuth2
|
7
|
+
|
8
|
+
option :name, "snapchat"
|
9
|
+
|
10
|
+
option :client_options, {
|
11
|
+
site: 'https://adsapi.snapchat.com',
|
12
|
+
authorize_url: 'https://accounts.snapchat.com/login/oauth2/authorize',
|
13
|
+
token_url: 'https://accounts.snapchat.com/login/oauth2/access_token'
|
14
|
+
}
|
15
|
+
|
16
|
+
uid { raw_info['me']['id'] }
|
17
|
+
|
18
|
+
info do
|
19
|
+
{
|
20
|
+
email: raw_info['me']['email'],
|
21
|
+
organization_id: raw_info['me']['organization_id'],
|
22
|
+
display_name: raw_info['me']['display_name'],
|
23
|
+
member_status: raw_info['me']['member_status']
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
extra do
|
28
|
+
{
|
29
|
+
'raw_info' => raw_info
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def raw_info
|
34
|
+
raw_info_url = "https://adsapi.snapchat.com/v1/me"
|
35
|
+
@raw_info ||= access_token.get(raw_info_url).parsed
|
36
|
+
end
|
37
|
+
|
38
|
+
def callback_url
|
39
|
+
options[:redirect_uri] || full_host + script_name + callback_path
|
40
|
+
end
|
41
|
+
|
42
|
+
def token_params
|
43
|
+
authorization = Base64.strict_encode64("#{options.client_id}:#{options.client_secret}")
|
44
|
+
super.merge({
|
45
|
+
headers: {
|
46
|
+
"Authorization" => "Basic #{authorization}"
|
47
|
+
}
|
48
|
+
})
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "omniauth/snapchat/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "omniauth-snapchat"
|
8
|
+
spec.version = Omniauth::Snapchat::VERSION
|
9
|
+
spec.authors = ["Kristoffer Ek"]
|
10
|
+
|
11
|
+
spec.summary = "OnmiAuth Snapchat strategy"
|
12
|
+
spec.homepage = "https://github.com/kristofferek/omniauth-snapchat"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split("\n")
|
16
|
+
|
17
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
18
|
+
spec.add_runtime_dependency "omniauth-oauth2", "~> 1.6"
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-snapchat
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kristoffer Ek
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-04-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: omniauth-oauth2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- Gemfile
|
48
|
+
- Gemfile.lock
|
49
|
+
- LICENSE.txt
|
50
|
+
- README.md
|
51
|
+
- lib/omniauth-snapchat.rb
|
52
|
+
- lib/omniauth/snapchat/version.rb
|
53
|
+
- lib/omniauth/strategies/snapchat.rb
|
54
|
+
- omniauth-snapchat.gemspec
|
55
|
+
homepage: https://github.com/kristofferek/omniauth-snapchat
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 2.7.6.2
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: OnmiAuth Snapchat strategy
|
79
|
+
test_files: []
|