omniauth-deezer 0.3.0 → 0.4.0
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 +4 -4
- data/lib/omniauth/deezer/version.rb +1 -1
- data/lib/omniauth/strategies/deezer.rb +12 -13
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78bd9c56fc8572deca41650dc3bdf0594ab3c1f4
|
4
|
+
data.tar.gz: e922ca6821aa67dc99ac22b527cd08957a031450
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a8dcfd51e45c8326db6047331627e0473b27bba8c5f122689ba999483a03a2b84f90a12871dd4a3a828948fbda2752ebfd51b2efeaef80269d02bd1feda30c3
|
7
|
+
data.tar.gz: 0536d463fded0b27eea8d3408168c64a5695cea2480e282a064508278f16acfb77f62909660e315abc3e145f1e2505f603df7b0b0a4b5949012a8165dd6daf73
|
@@ -6,7 +6,7 @@ require 'multi_json'
|
|
6
6
|
|
7
7
|
module OmniAuth
|
8
8
|
module Strategies
|
9
|
-
class Deezer
|
9
|
+
class Deezer
|
10
10
|
include OmniAuth::Strategy
|
11
11
|
|
12
12
|
DEFAULT_PERMS = "basic_access"
|
@@ -14,7 +14,7 @@ module OmniAuth
|
|
14
14
|
option :name, "deezer"
|
15
15
|
|
16
16
|
# request phase
|
17
|
-
|
17
|
+
|
18
18
|
args [:app_id,:app_secret]
|
19
19
|
|
20
20
|
option :client_options, {
|
@@ -27,23 +27,24 @@ module OmniAuth
|
|
27
27
|
|
28
28
|
def request_phase
|
29
29
|
options.perms ||= DEFAULT_PERMS
|
30
|
-
|
31
|
-
|
30
|
+
new_url_to_go = callback_url.split('?')[0]
|
31
|
+
|
32
|
+
redirect "#{options.client_options.authorize_url}?app_id=#{options.app_id}&redirect_uri=#{CGI.escape(new_url_to_go)}&perms=#{options.perms}"
|
32
33
|
end
|
33
34
|
|
34
35
|
# callback phase
|
35
36
|
|
36
37
|
def callback_phase
|
37
38
|
begin
|
38
|
-
if request.params['error_reason'] then
|
39
|
-
raise CredentialsError, request.params['error_reason']
|
39
|
+
if request.params['error_reason'] then
|
40
|
+
raise CredentialsError, request.params['error_reason']
|
40
41
|
end
|
41
42
|
|
42
43
|
# get token from Deezer
|
43
|
-
token_url = options.client_options.token_url
|
44
|
-
|
44
|
+
token_url = "#{options.client_options.token_url}?app_id=#{options.app_id}&secret=#{options.app_secret}&code=#{request.params['code']}"
|
45
|
+
|
45
46
|
connection = nil
|
46
|
-
if options.client_options.ssl && options.client_options.ssl.ca_path then
|
47
|
+
if options.client_options.ssl && options.client_options.ssl.ca_path then
|
47
48
|
connection = Faraday::Connection.new token_url, :ssl => {:ca_path => options.client_options.ssl.ca_path }
|
48
49
|
else
|
49
50
|
connection = Faraday::Connection.new token_url
|
@@ -61,7 +62,6 @@ module OmniAuth
|
|
61
62
|
@raw_info = MultiJson.decode(response.body.chomp)
|
62
63
|
|
63
64
|
super
|
64
|
-
|
65
65
|
rescue ::MultiJson::DecodeError => e
|
66
66
|
fail!(:invalid_response, e)
|
67
67
|
rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e
|
@@ -70,7 +70,7 @@ module OmniAuth
|
|
70
70
|
fail!(:failed_to_connect, e)
|
71
71
|
rescue TypeError => e
|
72
72
|
fail!(:invalid_response, e)
|
73
|
-
rescue CredentialsError => e
|
73
|
+
rescue CredentialsError => e
|
74
74
|
fail!(:invalid_credentials, e)
|
75
75
|
end
|
76
76
|
end
|
@@ -78,7 +78,7 @@ module OmniAuth
|
|
78
78
|
uid { @raw_info['id'] }
|
79
79
|
|
80
80
|
info do
|
81
|
-
h =
|
81
|
+
h =
|
82
82
|
{
|
83
83
|
:name => @raw_info['firstname']+' '+@raw_info['lastname'],
|
84
84
|
:nickname => @raw_info['name'],
|
@@ -116,7 +116,6 @@ module OmniAuth
|
|
116
116
|
self.error = error
|
117
117
|
end
|
118
118
|
end
|
119
|
-
|
120
119
|
end
|
121
120
|
end
|
122
121
|
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-deezer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoffroy Montel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: Deezer strategy for Omniauth 1.0
|
@@ -45,7 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .gitignore
|
48
|
+
- ".gitignore"
|
49
49
|
- Gemfile
|
50
50
|
- Rakefile
|
51
51
|
- Readme.md
|
@@ -63,17 +63,17 @@ require_paths:
|
|
63
63
|
- lib
|
64
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- -
|
71
|
+
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
75
|
rubyforge_project: omniauth-deezer
|
76
|
-
rubygems_version: 2.
|
76
|
+
rubygems_version: 2.6.13
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: Deezer strategy for Omniauth 1.0
|