omniauth-vkontakte 1.0.6 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,16 +1,33 @@
1
1
  # OmniAuth VKontakte
2
2
 
3
- This is the unofficial OmniAuth strategy for authenticating to VKontakte via OAuth.
3
+ This is the unofficial [OmniAuth](https://github.com/intridea/omniauth) strategy for authenticating to VKontakte via OAuth.
4
4
  To use it, you'll need to sign up for an OAuth2 Application ID and Secret
5
5
  on the [Vkontakte Developers Page](http://vk.com/developers.php).
6
6
 
7
7
  ## Basic Usage
8
8
 
9
- use OmniAuth::Builder do
10
- provider :vkontakte, ENV['API_KEY'], ENV['API_SECRET'], :scope => 'friends,audio', :display => 'popup'
11
- end
9
+ ```ruby
10
+ use OmniAuth::Builder do
11
+ provider :vkontakte, ENV['API_KEY'], ENV['API_SECRET']
12
+ end
13
+ ```
12
14
 
13
- ## Ruby
15
+ ## Configuring
16
+ You can configure several options, which you pass in to the `provider` method via a `Hash`:
17
+
18
+ * `scope`: A comma-separated list of permissions you want to request from the user. [Read the Vkontakte docs for more details](http://vk.com/developers.php?oid=-1&p=%D0%9F%D1%80%D0%B0%D0%B2%D0%B0_%D0%B4%D0%BE%D1%81%D1%82%D1%83%D0%BF%D0%B0_%D0%BF%D1%80%D0%B8%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D0%B9)
19
+ * `display`: The display context to show the authentication page. Options are: `page`, `popup`, `touch` and `wap`.
20
+
21
+ For example, to request `friends`, `audio` and `photos` permissions and display the authentication page in a popup window:
22
+
23
+ ```ruby
24
+ use OmniAuth::Builder do
25
+ provider :vkontakte, ENV['API_KEY'], ENV['API_SECRET'],
26
+ :scope => 'friends,audio,photos', :display => 'popup'
27
+ end
28
+ ```
29
+
30
+ ## Supported Rubies
14
31
 
15
32
  Tested with the following Ruby versions:
16
33
 
@@ -19,7 +36,7 @@ Tested with the following Ruby versions:
19
36
 
20
37
  ## License
21
38
 
22
- Copyright (c) 2011, 2012 Anton Maminov.
39
+ Copyright (c) 2011, 2012 Anton Maminov
23
40
 
24
41
  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:
25
42
 
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Vkontakte
3
- VERSION = "1.0.6"
3
+ VERSION = "1.0.8"
4
4
  end
5
5
  end
@@ -11,7 +11,7 @@ module OmniAuth
11
11
  # @example Basic Usage
12
12
  # use OmniAuth::Strategies::Vkontakte, 'API Key', 'Secret Key'
13
13
  class Vkontakte < OmniAuth::Strategies::OAuth2
14
- DEFAULT_SCOPE = 'friends,audio'
14
+ DEFAULT_SCOPE = ''
15
15
 
16
16
  option :name, 'vkontakte'
17
17
 
@@ -62,8 +62,14 @@ module OmniAuth
62
62
  #
63
63
  def authorize_params
64
64
  super.tap do |params|
65
- params.merge!(:display => request.params['display']) if request.params['display']
66
- params.merge!(:scope => request.params['scope']) if request.params['scope']
65
+ # just a copypaste from ominauth-facebook
66
+ %w[display state scope].each do |v|
67
+ if request.params[v]
68
+ params[v.to_sym] = request.params[v]
69
+ # to support omniauth-oauth2's auto csrf protection
70
+ session['omniauth.state'] = params[:state] if v == 'state'
71
+ end
72
+ end
67
73
  params[:scope] ||= DEFAULT_SCOPE
68
74
  end
69
75
  end
@@ -2,7 +2,7 @@
2
2
  require File.expand_path('../lib/omniauth-vkontakte/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.add_dependency 'omniauth', '~> 1.0'
5
+ gem.add_dependency 'omniauth', '~> 1.1.0'
6
6
  gem.add_dependency 'omniauth-oauth2', '~> 1.0'
7
7
  gem.add_dependency 'multi_json'
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-vkontakte
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,27 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-04 00:00:00.000000000 Z
12
+ date: 2012-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth
16
- requirement: &85957200 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '1.0'
21
+ version: 1.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *85957200
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.1.0
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: omniauth-oauth2
27
- requirement: &85956390 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '1.0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *85956390
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: multi_json
38
- requirement: &85956070 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,7 +53,12 @@ dependencies:
43
53
  version: '0'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *85956070
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  description: Unofficial VKontakte strategy for OmniAuth 1.0
48
63
  email:
49
64
  - anton.linux@gmail.com
@@ -79,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
94
  version: '0'
80
95
  requirements: []
81
96
  rubyforge_project:
82
- rubygems_version: 1.8.10
97
+ rubygems_version: 1.8.24
83
98
  signing_key:
84
99
  specification_version: 3
85
100
  summary: Unofficial VKontakte strategy for OmniAuth 1.0