omniauth-spotify-oauth2 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59bebbc31c15e1f0ccf9466d0b1d66cb6a530d00
4
- data.tar.gz: a504e2c80c73f6a51e304cd6da83b08f0bcb81b5
3
+ metadata.gz: 0f69c7fc0e579477122e7599801fcdc831d6c819
4
+ data.tar.gz: 498f23024568356dd7f1a8bda015ad5e6f336aa2
5
5
  SHA512:
6
- metadata.gz: e0a4d57cea3e8dd3f1961ccf98a96147b166865402db0d83f59be42c6260b7b110b32f2999b29e8178db6d665f6237e9478e1089160c13089fa448cf5f1d8eb6
7
- data.tar.gz: de15758d4dbb4fe6932d536b032d902873bcbe9dbc38d34ddea5690d4561fda4305dc1c9ad0256be9fcc7647d2fb3dbe9946f57ea3741fa54df902ed2ebc615f
6
+ metadata.gz: 19c8261eefec63c1af0b8245fcdfcf0909af3c930a4be705218fd35959d4e03d6a5212e97172e9293de5824f83b26a498737cc2925d182ac9581ec2567aa23ca
7
+ data.tar.gz: cc71825372aeb659f048759ed428ffb9bfba589e46060b0e5b09c47080f0fa3920c387977a39f17559c6ab295183bdccace565bf2514f0c799c0946f4264283b
@@ -0,0 +1,2 @@
1
+ .DS_Store
2
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2016 Jonathan Tribouharet
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # OmniAuth Spotify OAuth2
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/omniauth-spotify-oauth2.svg)](http://badge.fury.io/rb/omniauth-spotify-oauth2)
4
+
5
+ Strategy to authenticate [Spotify](https://www.spotify.com) in OmniAuth.
6
+
7
+ ## Installation
8
+
9
+ OmniAuth Spotify OAuth2 is distributed as a gem, which is how it should be used in your app.
10
+
11
+ Include the gem in your Gemfile:
12
+
13
+ gem 'omniauth-spotify-oauth2', '~> 1.0'
14
+
15
+ Integrate this strategy to your OmniAuth middleware.
16
+
17
+ ```ruby
18
+ Rails.application.config.middleware.use OmniAuth::Builder do
19
+ provider :spotify, ENV['SPOTIFY_CLIENT_ID'], ENV['SPOTIFY_CLIENT_SECRET']
20
+ end
21
+ ```
22
+
23
+ ## Author
24
+
25
+ - [Jonathan Tribouharet](https://github.com/jonathantribouharet) ([@johntribouharet](https://twitter.com/johntribouharet))
26
+
27
+ ## License
28
+
29
+ OmniAuth Spotify OAuth2 is released under the MIT license. See the LICENSE file for more info.
@@ -0,0 +1,2 @@
1
+ require "omniauth-spotify-oauth2/version"
2
+ require 'omniauth/strategies/spotify'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Spotify
3
+ VERSION = '1.0.1'
4
+ end
5
+ end
@@ -0,0 +1,51 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Spotify < OmniAuth::Strategies::OAuth2
6
+
7
+ option :name, "spotify"
8
+
9
+ option :client_options, {
10
+ :site => 'https://api.spotify.com/v1',
11
+ :authorize_url => 'https://accounts.spotify.com/authorize',
12
+ :token_url => 'https://accounts.spotify.com/api/token',
13
+ }
14
+
15
+ uid { raw_info['id'] }
16
+
17
+ info do
18
+ {
19
+ :name => raw_info['display_name'],
20
+ :urls => raw_info['external_urls'],
21
+ :email => raw_info['email'],
22
+ :image => image_url,
23
+ :location => raw_info['country'],
24
+ }
25
+ end
26
+
27
+ extra do
28
+ {
29
+ 'raw_info' => raw_info
30
+ }
31
+ end
32
+
33
+ def image_url
34
+ if raw_info['images'] && raw_info['images'][0]
35
+ raw_info['images'][0]['url']
36
+ end
37
+ end
38
+
39
+ def raw_info
40
+ @raw_info ||= access_token.get('me').parsed
41
+ end
42
+
43
+ # Required for omniauth-oauth2 >= 1.4
44
+ # https://github.com/intridea/omniauth-oauth2/issues/81
45
+ def callback_url
46
+ full_host + script_name + callback_path
47
+ end
48
+
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path("../lib/omniauth-spotify-oauth2/version", __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = "omniauth-spotify-oauth2"
5
+ gem.summary = "OmniAuth Strategy for Spotify via OAuth2"
6
+ gem.description = "OmniAuth Strategy for Spotify via OAuth2"
7
+ gem.homepage = "https://github.com/jonathantribouharet/omniauth-spotify-oauth2"
8
+ gem.version = OmniAuth::Spotify::VERSION
9
+ gem.files = `git ls-files`.split("\n")
10
+ gem.require_paths = ["lib"]
11
+ gem.authors = ['Jonathan TRIBOUHARET']
12
+ gem.email = 'jonathan.tribouharet@gmail.com'
13
+ gem.license = 'MIT'
14
+ gem.platform = Gem::Platform::RUBY
15
+
16
+ gem.add_dependency 'omniauth-oauth2', '~> 1.4'
17
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-spotify-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan TRIBOUHARET
@@ -29,7 +29,15 @@ email: jonathan.tribouharet@gmail.com
29
29
  executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files: []
32
- files: []
32
+ files:
33
+ - .gitignore
34
+ - Gemfile
35
+ - LICENSE.md
36
+ - README.md
37
+ - lib/omniauth-spotify-oauth2.rb
38
+ - lib/omniauth-spotify-oauth2/version.rb
39
+ - lib/omniauth/strategies/spotify.rb
40
+ - omniauth-spotify-oauth2.gemspec
33
41
  homepage: https://github.com/jonathantribouharet/omniauth-spotify-oauth2
34
42
  licenses:
35
43
  - MIT