ruby on rails - Venmo / Oauth Missing argument: client_id., code: 241 -


i'm using oauth try , login through venmo based on this guide. isn't official , venmo docs don't show code example ruby.

at first, couldn't see venmo login. removed env , brackets around id , secret in initializer , see login. when submit , hits call error: (and think retries endlessly...i have manually shut down server)

{"error": {"message": "missing argument: client_id.", "code": 241}} i, [2014-04-16t11:49:48.124423 #47700]  info -- omniauth: (venmo) callback phase initiated. e, [2014-04-16t11:49:48.345202 #47700] error -- omniauth: (venmo) authentication failure!       invalid_credentials: oauth2::error, {"message"=>"missing argument: client_id.", "code"=>241}:  

here route:

get 'users/auth/venmo/callback' => 'omniauth_callbacks_controller#create' 

gems:

gem 'devise' gem 'omniauth' gem 'omniauth-venmo' 

i have in initializers/omniauth.rb

rails.application.config.middleware.use omniauth::builder    provider :venmo, 'id', 'secret', :scope => 'access_feed,access_profile,access_friends,make_payments'    end 

this callback controller

class omniauthcallbackscontroller < devise::omniauthcallbackscontroller def venmo     @user = user.find_for_oauth(env["omniauth.auth"], current_user)     raise     if @user.persisted?         sign_in_and_redirect root_path, :event => :authentication         set_flash_message(:notice, :success, :kind => "venmo") if is_navigational_format?     else         session["devise.venmo_uid"] = env["omniauth.auth"]         redirect_to new_user_registration_url     end end  protected  def auth_hash     request.env['omniauth.auth'] end  

end

and have initializers/devise.rb

   require 'omniauth-venmo'    config.omniauth :venmo, "key", "secret" 

-- values filled in of course. appreciate help... thank you!!

update: i've pushed github repository , 1 of peers pulled it. did not same error. reason be..? here output

@peege151... created working solution devise integration said you..here code below, use reference purpose. don't exact solution raised question may since got working

gems:

gem 'rails 3.2.14' # important~ gem 'devise' gem 'omniauth' gem 'omniauth-venmo' 

i have not created omniauth.rb in initializers .... instead added configuration in devise.rb u wanted devise

my devise.rb :

require "omniauth-venmo" config.omniauth :venmo, '--your app key -- ', '-- app secret--',{:client_options => {:ssl => {:verify => false}}} 

above line have set ssl verification false,, if u want enable ssl (:verify => true).

this callback controller code:

class users::omniauthcallbackscontroller < devise::omniauthcallbackscontroller   def venmo     @user = user.find_for_oauth(request.env["omniauth.auth"], current_user)     if @user.persisted?       sign_in_and_redirect @user, :event => :authentication       set_flash_message(:notice, :success, :kind => "venmo") if is_navigational_format?     else       session["devise.twitter_uid"] = request.env["omniauth.auth"]       redirect_to new_user_registration_url    end   end   end 

user.rb code:

class user < activerecord::base   temp_email = 'change@me.com'   temp_email_regex = /change@me.com/    devise :database_authenticatable, :registerable,      :recoverable, :rememberable, :trackable, :validatable    # setup accessible (or protected) attributes model   attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :provider , :uid    devise :omniauthable    def self.find_for_oauth(auth, signed_in_resource=nil)        user = user.where(:provider => auth.provider, :uid => auth.uid).first       if user          return user       else          registered_user = user.where(:email => auth.info.email).first          if registered_user            return registered_user         else            user = user.create(name:auth.extra.raw_info.name,                           provider:auth.provider,                           uid:auth.uid,                           email:auth.info.email.blank? ? temp_email : auth.info.email,                           password:devise.friendly_token[0,20],                         )                  end                 end       user     end   end 

here devise , callback routes.rb:

 devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }  '/auth/venmo/callback' => 'users/omniauth_callbacks#venmo' 

login page link:

<%= link_to "sign in venmo", user_omniauth_authorize_path(:venmo) %>  

screenshot:

enter image description here


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -