omniauth-deezer 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -36,6 +36,20 @@ Rails.application.config.middleware.use OmniAuth::Builder do
36
36
  end
37
37
  ```
38
38
 
39
+ Like omniauth-facebook, if you get the following error when redirected back from Deezer :
40
+
41
+ ````bash
42
+ OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed)
43
+ ````
44
+
45
+ You need to point your app to your SSL certificates directory :
46
+
47
+ ```ruby
48
+ Rails.application.config.middleware.use OmniAuth::Builder do
49
+ provider :deezer, ENV['DEEZER_APP_ID'], ENV['DEEZER_APP_SECRET'], :perms => 'basic_access,email', :client_options => {:ssl => {:ca_path => '/etc/ssl/certs'}}
50
+ end
51
+ ```
52
+
39
53
  Then change your routes in your application `config/routes.rb`
40
54
 
41
55
  ```ruby
@@ -94,6 +108,11 @@ extra:
94
108
 
95
109
  The precise information available may depend on the permissions which you request.
96
110
 
111
+ ## Sample app
112
+
113
+ You can find a sample app that use this GEM here :
114
+ https://github.com/geoffroymontel/omniauth-deezer-test
115
+
97
116
  ## Supported Rubies
98
117
 
99
118
  Actively tested with the following Ruby versions:
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Deezer
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -18,8 +18,8 @@ module OmniAuth
18
18
  args [:app_id,:app_secret]
19
19
 
20
20
  option :client_options, {
21
- :authorize_url => 'http://connect.deezer.com/oauth/auth.php',
22
- :token_url => 'http://connect.deezer.com/oauth/access_token.php',
21
+ :authorize_url => 'https://connect.deezer.com/oauth/auth.php',
22
+ :token_url => 'https://connect.deezer.com/oauth/access_token.php',
23
23
  :me_url => 'http://api.deezer.com/2.0/user/me'
24
24
  }
25
25
 
@@ -40,13 +40,22 @@ module OmniAuth
40
40
  end
41
41
 
42
42
  # get token from Deezer
43
+ token_url = options.client_options.token_url
43
44
  token_url = options.client_options.token_url+'?app_id='+options.app_id+'&secret='+options.app_secret+'&code='+request.params['code']
44
- response = Faraday.get token_url
45
+ connection = nil
46
+ if options.client_options.ssl.ca_path then
47
+ connection = Faraday::Connection.new token_url, :ssl => {:ca_path => options.client_options.ssl.ca_path }
48
+ else
49
+ connection = Faraday::Connection.new token_url
50
+ end
51
+ response = connection.get token_url
52
+
45
53
  response_hash = CGI::parse(response.body.chomp)
46
54
  @access_token = response_hash['access_token'][0]
47
55
  @token_expires_at = response_hash['expires'][0].to_i
48
- me_path = options.client_options.me_url+'?access_token='+@access_token
56
+
49
57
  # get info from current user
58
+ me_path = options.client_options.me_url+'?access_token='+@access_token
50
59
  response = Faraday.get me_path
51
60
  @raw_info = MultiJson.decode(response.body.chomp)
52
61
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-deezer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-09 00:00:00.000000000Z
12
+ date: 2012-02-10 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth
16
- requirement: &71363960 !ruby/object:Gem::Requirement
16
+ requirement: &73909590 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *71363960
24
+ version_requirements: *73909590
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: faraday
27
- requirement: &71363690 !ruby/object:Gem::Requirement
27
+ requirement: &73909300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *71363690
35
+ version_requirements: *73909300
36
36
  description: Deezer strategy for Omniauth 1.0
37
37
  email:
38
38
  - coder@minizza.com