A
A
Anton Misyagin2016-06-02 20:37:35
Ruby on Rails
Anton Misyagin, 2016-06-02 20:37:35

How to log in through classmates?

gemfile

gem 'rails', '4.2.5'
gem 'devise', '3.5.1'
gem 'omniauth-odnoklassniki'

I registered the application, I received an email:
0b70fedb89ed4d8683d06ce5ff11eb92.pngconfig/initializers/devise.rb
...
  config.omniauth :odnoklassniki,
            Rails.application.secrets.odnoklassniki_app_id,
            Rails.application.secrets.odnoklassniki_app_secret
...

secrets.yml
odnoklassniki_app_id: '1xxxxxxxxx8' пробовал еще CxxxxxxxxA
  odnoklassniki_app_secret: BxxxxxxxxxxxxxxxxxB

I click on the site Login. Goes to the Odnoklassniki page. It asks to enter a password, and then:
Invalid credentials, if odnoklassniki_app_id: '1xxxxxxxxx8'
and
ca5595db140b472cabab212cb99cc686.png
if odnoklassniki_app_id: CxxxxxxxxA
Hmm, in general, it does not enter through the device. VK, Twitter are already set up, but Odnoklassniki do not want
In the documentation:
use OmniAuth::Builder do
  provider :odnoklassniki, ENV['APP_ID'], ENV['APP_SECRET_KEY'], :public_key => ENV['APP_PUBLIC_KEY'],
    :scope => 'VALUABLE_ACCESS'
end

Those. it seems like you need to specify three parameters, but in the device only 2. How to be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Misyagin, 2016-06-02
@sunnmas

/config/initializers/odnoklassniki.rb:

# Fix Odnoklassniki OAuth gem via
# https://github.com/incubus/omniauth-odnoklassniki/issues/10

OmniAuth::Strategies::Odnoklassniki.class_eval do
  def callback_url
    options.redirect_url || (full_host + script_name + callback_path)
  end
end

config.omniauth :odnoklassniki,
            Rails.application.secrets.odnoklassniki_app_id,
            Rails.application.secrets.odnoklassniki_app_secret,
            :public_key => Rails.application.secrets.odnoklassniki_app_public

odnoklassniki_app_id: '1xxxxxxx8'
  odnoklassniki_app_public: CxxxxxxxxxxxxxA
  odnoklassniki_app_secret: BxxxxxxxxxxxxxxxxxxxxB

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question