quickbooks-ruby
quickbooks-ruby copied to clipboard
uninitialized constant OAuth (NameError) Did you mean? OAuth2
Hi guys,
I'm currently at quickbooks-ruby 1.0.1 and everything is working perfectly, But the moment I use 1.0.3 or higher, I get this error message when starting the rails server:
uninitialized constant OAuth (NameError) Did you mean? OAuth2
It's referring to this line (/config/initializers/quickbooks.rb):
$qb_oauth_consumer = OAuth::Consumer.new(QB_KEY, QB_SECRET, {
:site => "https://oauth.intuit.com",
:request_token_path => "/oauth/v1/get_request_token",
:authorize_url => "https://appcenter.intuit.com/Connect/Begin",
:access_token_path => "/oauth/v1/get_access_token"
})
reverting back to quickbooks-ruby 1.0.1 makes everything run properly again.
Am I missing some 'require' statement somewhere or does the piece of code above need updating?
Thanks!
@varun43in That very old 1.0.1 version of the gem allowed either OAuth 1 or OAuth2 (https://github.com/ruckus/quickbooks-ruby/blob/1.0.1/quickbooks-ruby.gemspec). It looks like as of version 1.0.2, only OAuth 2 is supported (https://github.com/ruckus/quickbooks-ruby/blob/1.0.2/quickbooks-ruby.gemspec).
Intuit stopped supporting OAuth 1 on accounts a while back (https://blogs.intuit.com/blog/2018/12/20/oauth-1-0-deprecation-migrate-oauth-2-0-december-17-2019/). So, you'll presumably want to move to OAuth 2 (any newer development account is using that).
I'd start by looking at https://github.com/ruckus/quickbooks-ruby/tree/1.0.3#getting-started--initiating-authentication-flow-with-intuit (or later versions) - the start of the changes you'll want is moving from OAuth::Consumer
to OAuth2::Client
.