Class: OmniAuth::Strategies::Vkontakte
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Vkontakte
- Defined in:
- lib/omniauth/strategies/vkontakte.rb
Overview
Authenticate to Vkontakte utilizing OAuth 2.0 and retrieve basic user information. documentation available here: vk.com/dev/authentication
Defined Under Namespace
Classes: NoRawData
Constant Summary collapse
- API_VERSION =
'5.107'
- DEFAULT_SCOPE =
''
Instance Method Summary collapse
-
#authorize_params ⇒ Object
You can pass
display
,revoke
orscope
params to the auth request, if you need to set them dynamically. - #raw_info ⇒ Object
Instance Method Details
#authorize_params ⇒ Object
You can pass display
, revoke
or scope
params to the auth request, if you need to set them dynamically.
revoke
revokes access and re-authorizes user.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/omniauth/strategies/vkontakte.rb', line 77 def super.tap do |params| # just a copypaste from ominauth-facebook %w[display state scope revoke].each do |v| next unless request.params[v] params[v.to_sym] = request.params[v] # to support omniauth-oauth2's auto csrf protection session['omniauth.state'] = params[:state] if v == 'state' end params[:scope] ||= DEFAULT_SCOPE end end |
#raw_info ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/omniauth/strategies/vkontakte.rb', line 59 def raw_info access_token.[:mode] = :query access_token.[:param_name] = :access_token @raw_info ||= begin result = access_token.get('/method/users.get', params: params).parsed['response'] raise NoRawData, result unless result.is_a?(Array) && result.first result.first end end |