Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError: undefined method `[]' for nil:NilClass #17

Closed
cre-o opened this issue Nov 29, 2012 · 15 comments
Closed

NoMethodError: undefined method `[]' for nil:NilClass #17

cre-o opened this issue Nov 29, 2012 · 15 comments

Comments

@cre-o
Copy link

cre-o commented Nov 29, 2012

С каждым днем все интереснее, пользователей правда пугает регистрация без вконтакте.
Выскакивает после нажатия на "разрешить" и редирект на приложение.

…h-vkontakte-1.1.2/lib/omniauth/strategies/vkontakte.rb: 37:in block in <class:Vkontakte>' …uby/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb: 102:ininstance_eval'
…uby/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb: 102:in block in compile_stack' …uby/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb: 101:ineach'
…uby/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb: 101:in inject' …uby/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb: 101:incompile_stack'
…uby/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb: 315:in info' …uby/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb: 328:inauth_hash'
…uby/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb: 355:in callback_phase' …mniauth-oauth2-1.1.1/lib/omniauth/strategies/oauth2.rb: 77:incallback_phase'
…uby/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb: 219:in callback_call' …uby/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb: 175:incall!'
…uby/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb: 157:in call' …ations-3.1.4/lib/client_side_validations/middleware.rb: 18:incall'
…ems/ruby/1.9.1/gems/warden-1.2.1/lib/warden/manager.rb: 35:in block in call' …ems/ruby/1.9.1/gems/warden-1.2.1/lib/warden/manager.rb: 34:incatch'
…ems/ruby/1.9.1/gems/warden-1.2.1/lib/warden/manager.rb: 34:in call' …hared/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/etag.rb: 23:incall'
…/ruby/1.9.1/gems/rack-1.4.1/lib/rack/conditionalget.rb: 25:in call' …/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb: 205:incontext'
…/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb: 200:in call' …/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb: 21:incall'
…ed/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb: 17:in call' …hared/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb: 15:incall'
…by/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb: 136:in forward' …by/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb: 245:infetch'
…by/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb: 185:in lookup' …by/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb: 66:incall!'
…by/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb: 51:in call' …by/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb: 535:inprocess_client'
…by/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb: 610:in worker_loop' …by/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb: 491:inspawn_missing_workers'
…by/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb: 502:in maintain_worker_count' …by/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb: 276:injoin'

@cre-o
Copy link
Author

cre-o commented Nov 29, 2012

Мне кажется метод getProfiles устарел и юзать нужно users.get
Убрали getProfiles из документации.

@mamantoha
Copy link
Owner

Похоже проблема не в методе getProfiles
ВКонтакте стал возвращать для всех методов:

{"error":{"error_code":5,"error_msg":"User authorization failed: user revoke access for this token."

@mamantoha
Copy link
Owner

Кроме этого параметр uid больше не поддерживается. Используется uids.
Но это не решает проблему.

@cre-o
Copy link
Author

cre-o commented Nov 29, 2012

def raw_info
  # http://vk.com/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']

  @raw_info ||= begin
    params = {
        :uids         => uid,
        :fields       => fields.join(','),
        :access_token => access_token.token
    }
    result = access_token.get('/method/users.get', :params => params).parsed["response"]
    result && result.first ? result.first : nil
  end
end

Этот код работает.
Поле domain больше не используется.

@sars
Copy link

sars commented Nov 29, 2012

блин.. задолбали они ...
...subscribe ...

@mamantoha
Copy link
Owner

Страну и город тоже получает?
А то у меня вообще ничего не работает.

ВКонтакте последнее время совсем упоролись

mamantoha added a commit that referenced this issue Nov 29, 2012
@ehlyzov
Copy link

ehlyzov commented Dec 13, 2012

А удалось выяснить откуда берется "User authorization failed: user revoke access for this token." и что с ней делать? Фикс не помог :-/

@ehlyzov
Copy link

ehlyzov commented Dec 13, 2012

точнее, если не передавать access_token то это, конечно, поможет. Но при этом отдается только та инфа, которую пользователь выставил наружу. В моем случае, не отдается city_id, который нужен.

@mamantoha
Copy link
Owner

Да, раньше была проблема. Сейчас попробовал, вроде все отдается.

@ksevelyar
Copy link
Contributor

Снова эта ошибка:

NoMethodError: undefined method `[]' for nil:NilClass
[GEM_ROOT]/bundler/gems/omniauth-vkontakte-8629dfeeef23/lib/omniauth/strategies/vkontakte.rb:36

@Houdini
Copy link

Houdini commented Mar 21, 2013

+1

2 similar comments
@babi4
Copy link

babi4 commented Jun 11, 2013

+1

@sergeymishin
Copy link

+1

@OlegPasko
Copy link

+1
Вот в этом месте uid { raw_info['id'].to_s }

@panasyuk
Copy link

panasyuk commented Dec 1, 2013

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants