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: vkontakte.ru/developers.php?o=-17680044&p=Authorization&s=0
Constant Summary collapse
- DEFAULT_SCOPE =
'notify'
Instance Method Summary collapse
-
#authorize_params ⇒ Object
You can pass displayor
scope
params to the auth request, if you need to set them dynamically. - #raw_info ⇒ Object
Instance Method Details
#authorize_params ⇒ Object
You can pass displayor scope
params to the auth request, if you need to set them dynamically.
/auth/vkontakte?display=popup
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/omniauth/strategies/vkontakte.rb', line 63 def super.tap do |params| # just a copypaste from ominauth-facebook %w[display state scope].each do |v| if 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 end params[:scope] ||= DEFAULT_SCOPE end end |
#raw_info ⇒ Object
51 52 53 54 55 |
# File 'lib/omniauth/strategies/vkontakte.rb', line 51 def raw_info # http://vkontakte.ru/developers.php?o=-17680044&p=Description+of+Fields+of+the+fields+Parameter fields = ['uid', 'first_name', 'last_name', 'nickname', 'sex', 'city', 'country', 'online', 'bdate', 'photo', 'photo_big', 'domain'] @raw_info ||= access_token.get('/method/getProfiles', :params => { :uid => uid, :fields => fields.join(',') }).parsed["response"].first end |