GithubHelp home page GithubHelp logo

intuit / oauth-rubyclient Goto Github PK

View Code? Open in Web Editor NEW
29.0 12.0 32.0 58 KB

Ruby OAuth 2.0 client for QuickBooks Online

License: Apache License 2.0

Ruby 100.00%
ruby ruby-oauth-client qbo quickbooks sdk

oauth-rubyclient's People

Contributors

alexanderbelonogov avatar bertiecroll avatar caseyrollins avatar hlu2 avatar kjorbina avatar mculpsf avatar robert-mings avatar sethu-intuitdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oauth-rubyclient's Issues

Remove unused json_web_token dependency

Hi, thanks for providing the helpful library.

I may be mistaken, however I believe the json_web_token gem included as a dependency is currently unused. This gem has an alias of 'JWT' which conflicts with another gem required in our app.

The json_web_token provides an option to add an environment variable to exclude this alias, however if this gem is not being used by oauth-rubyclient can the gem be removed from being a dependency instead?

I'd be happy to submit a short PR if needed.
Many thanks

Support for claims query params for IntuitOAuth:: Flow:: AuthCode#get_auth_uri

Hello, would you be open to support an optional claims query params for get_auth_uri? Without it, I think we might need to manually build the URL to authenticate with quickbooks to use the accounting API. Seems simple enough to add if you are open to a PR to add this feature. See https://developer.intuit.com/app/developer/qbo/docs/develop/authentication-and-authorization/oauth-2.0#authorization-request for details, I'm not certain that this is required for the realmId to be passed in the callback, the documentation isn't very clear, maybe it is included in the callback regardless?

QUESTION: after authentication steps, how to pull information from the accounts?

Hi,

Happy thanksgiving.

I'm currently using Rails 6.0.1.

After obtaining the user's uid, token, refresh_token, realm_id, how can I pull invoices information from that point and beyond?

The current gem allows us to validate the user and obtain those credentials but I don't know how to continue to do queries via the ruby gem.

Any thoughts of next steps?

Variable names seem inconsistent

One one line, it declares a variable named client:
client = IntuitOAuth::Client.new('client_id', 'client_secret', 'redirectUrl', 'environment')

Then, a few lines down, it uses a variable named oauth_client:
authorizationCodeUrl = oauth_client.code.get_auth_uri(scopes)
Which gives an error: undefined local variable or method `oauth_client' for #QuickbooksController:0x0000558edb726b08.

A complete, working example would be extremely helpful.

IntuitOAuth::OAuth2ClientException Exception: HTTP status 401, error message: {"error":"invalid_client"}

class AuthController < ApplicationController
  before_action :oauth2_client

  def oauth2
    session[:state] = SecureRandom.uuid
    scopes = [
      IntuitOAuth::Scopes::ACCOUNTING,
      IntuitOAuth::Scopes::OPENID,
      IntuitOAuth::Scopes::PROFILE,
      IntuitOAuth::Scopes::EMAIL,
      IntuitOAuth::Scopes::PHONE,
      IntuitOAuth::Scopes::ADDRESS,
    ]
    
    redirect_to @client.code.get_auth_uri(scopes)
  end

  def callback
    authorization_code = params[:code]
    realm_id = params[:realmId]
    # get oauth2 tokens
    tokens = @client.token.get_bearer_token(authorization_code)
  end

  private

  def oauth2_client
    @client ||= IntuitOAuth::Client.new(
      ENV['QBO_API_CLIENT_ID'],
      ENV['QBO_API_CLIENT_SECRET '],
      ENV['QBO_REDIRECT_URI'],
      'sandbox'
    )
  end
end

Problem

tokens = @client.token.get_bearer_token(authorization_code)
*** IntuitOAuth::OAuth2ClientException Exception: HTTP status 401, error message: {"error":"invalid_client"}, intuit_tid: 1-5ebb4fc0-a1d1103a01a5ef86671f0dbe on Wed, 13 May 2020 01:39:12 GMT

Method oauth_client.Migrate doesn't exist

It looks like the method used in the documentation to migrate the tokens doesn't exist for the Oauth Client.
oauth_client.Migrate

However, calling oauth_client.migration.migrate_tokens(...) works.

Changes to identity signature keys

Hello,

In this Intuit blog post https://blogs.intuit.com/2023/09/05/changes-to-identity-signature-keys-that-may-impact-your-application/ its state that March 1st 2024 the response array from oauth.platform.intuit.com/op/v1/jwks will now return multiple keys.

Are there plans to update this repo to address the change?

Specifically, I believe these lines will be faulty after March 1, 2024:
](

keys = JSON.parse(body).fetch('keys').first
standard_kid = keys.fetch('kid')
kid_in_id_token = id_token_header_json.fetch('kid')
unless standard_kid.eql? kid_in_id_token
return false
end
)

Migration Tool Header is wrong

The Header of the Migration method is not correctly implemented and the API doesn't detect the scope.

'application/json' must be in 'Accept' Key of the Header

Easy Fix:

headers = {
                  Accept: 'application/json',
                  Authorization: oauth1_header
                }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.