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

uninitialized constant OAuth (NameError) Did you mean? OAuth2 #583

Open
varun43in opened this issue Sep 13, 2022 · 1 comment
Open

uninitialized constant OAuth (NameError) Did you mean? OAuth2 #583

varun43in opened this issue Sep 13, 2022 · 1 comment

Comments

@varun43in
Copy link

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!

@brianhenryhf
Copy link
Contributor

@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.

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

2 participants