intuit-oauth 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 917700b85f046e6e952c1f166e3c96e0282f7c0e
4
- data.tar.gz: 948f26d5fa00930af1aed91da1bf7106878b4bf7
3
+ metadata.gz: 984eb647d2b31559868614b3386ca08323589113
4
+ data.tar.gz: 7c0a99abf33f9b08c72d433f842a2b9a3f76db37
5
5
  SHA512:
6
- metadata.gz: fa1cd5b48ac1ca359eafc48615b7feaca03aa050dab44b5ca26ada1cb58a7dd672a4f905741ca57a6b18d5da842321348567b1eec052da408bab577e4fd688e4
7
- data.tar.gz: 3b0fb963c737087bb5ee9200f0ab3cc0f7bb49c2d0f9cd274d6fea9eff39cec46d24abd44cd47b6f243b8fa0d6c4f55af237432b3ed25f78682914cfe7876795
6
+ metadata.gz: 96de210f4e134fce0c26aee789dbfb95d44bc727dd1827be12327612f8c28f5f4e64f33d308b55c7fe034a4460b0c20429d6dd034287ffe8249b7bc229310620
7
+ data.tar.gz: ae7a0c38ca37ff3acaa563dd29765d6ed872597fe5257b4c46d4e3fb6b257348650d72387cc3cc1963de88bc521f88672d0c61d87c69fe9529ff9fd9de09b9eb
@@ -2,9 +2,13 @@ GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
4
  diff-lcs (1.3)
5
- httparty (0.16.2)
5
+ httparty (0.17.0)
6
+ mime-types (~> 3.0)
6
7
  multi_xml (>= 0.5.2)
7
8
  json (2.1.0)
9
+ mime-types (3.2.2)
10
+ mime-types-data (~> 3.2015)
11
+ mime-types-data (3.2019.0331)
8
12
  multi_xml (0.6.0)
9
13
  rspec (3.8.0)
10
14
  rspec-core (~> 3.8.0)
data/README.md CHANGED
@@ -1,107 +1,124 @@
1
+ [![SDK Banner](views/SDK.png)](https://help.developer.intuit.com/s/SDKFeedback?cid=1130)
2
+
1
3
  # oauth-rubyclient
2
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/intuit-oauth.svg)](https://badge.fury.io/rb/intuit-oauth)
6
+
3
7
  Intuit OAuth Ruby Client
4
8
  ==========================
5
9
 
6
- This client library is meant to work with Intuit's OAuth and OpenID implementation. The `AuthClient` object response can be used for User Info API, Accounting API and Payments API. This library supports:
7
-
8
- - Generating Authorization URL
9
- - Getting OAuth2 Bearer Token
10
- - Getting User Info
11
- - Validating OpenID token
12
- - Refreshing OAuth2 Token
13
- - Revoking OAuth2 Token
14
- - Migrating tokens from OAuth1.0 to OAuth2
15
-
16
- ## Installation
10
+ This tutorial describes how to use Intuit Ruby OAuth Client Library to generate access tokens for your QuickBooks Online Companies data. The Ruby OAuth Client Library provides a set of methods that make it easier to work with Intuit’s OAuth and OpenID protocol:
17
11
 
18
- Add this line to your application's Gemfile:
19
-
20
- ```ruby
21
- gem 'intuit-oauth'
22
- ```
12
+ - Generating Authorization URL
13
+ - Getting OAuth2 Bearer Token
14
+ - Getting User Info
15
+ - Validating OpenID token
16
+ - Refreshing OAuth2 Token
17
+ - Revoking OAuth2 Token
18
+ - Migrating tokens from OAuth1.0 to OAuth2
19
+
20
+ If you are not familiar with Intuit OAuth protocol, please refer to [Authentication and authorization page](https://developer.intuit.com/app/developer/qbo/docs/develop/authentication-and-authorization/oauth-2.0) for general information on OAuth.
21
+
22
+ The Ruby OAuth client would require Ruby version >= 1.9.0, and RubyGem version >= 1.3.5
23
23
 
24
- And then execute:
25
24
 
26
- $ bundle
25
+ ### Installation
27
26
 
28
- Or install it yourself as:
27
+ The Ruby OAuth library use gem for installation. To install the library, run:
29
28
 
30
29
  $ gem install 'intuit-oauth'
31
30
 
32
- ## Usage Examples
33
-
34
- The below example tells how to construct the IntuitOAuth Client and use it to generate an OAuth 2 token.
35
-
36
- ```ruby
37
- require 'intuit-oauth'
38
-
39
- client = IntuitOAuth::Client.new('client_id', 'client_secret', 'redirectUrl', 'environment')
40
- scopes = [
41
- IntuitOAuth::Scopes::ACCOUNTING
42
- ]
43
-
44
- authorizationCodeUrl = oauth_client.code.get_auth_uri(scopes)
45
- # => https://appcenter.intuit.com/connect/oauth2?client_id=clientId&redirect_uri=redirectUrl&response_type=code&scope=com.intuit.quickbooks.accounting&state=rMwcoDITc2N6FJsUGGO9
46
-
47
- oauth2Token = oauth_client.token.get_bearer_token('the authorization code returned from authorizationCodeUrl')
48
- # => #<IntuitOAuth::ClientResponse:0x00007f9152b5c418 @access_token="the access token", @expires_in=3600, @refresh_token="the refresh token", @x_refresh_token_expires_in=8726400>
49
-
50
- ```
51
-
52
- ### Initialize OAuth client object
31
+ You can also download the source code and run:
53
32
 
54
- Create an OAuth 2 client to send requests
33
+ $ gem build intuit-oauth.gemspec
55
34
 
56
- oauth_client = IntuitOAuth::Client.new('YourClientID', 'YourClientSecret', 'http://localhost:3000/token/new', 'sandbox')
35
+ to build your own gem if you want to modify a certain functions in the library
36
+
37
+ ### Create client instance
57
38
 
58
- ### Add scopes
39
+ In order to start using the library, the first step is to create a client object. Instantiate the IntuitOAuth object with app’s ClientID, ClientSecret, Redirect URL and the right environment. Valid values for environment include sandbox and production. redirect_uri should be set in your Intuit Developer app’s Keys tab under the right environment.
59
40
 
60
- Define the scopes for the app
41
+ ```ruby
42
+ require 'intuit-oauth'
43
+
44
+ oauth_client = IntuitOAuth::Client.new('client_id', 'client_secret', 'redirectUrl', 'environment')
45
+ ```
61
46
 
62
- scopes = [
63
- IntuitOAuth::Scopes::ACCOUNTING
64
- ]
65
-
66
47
  ### General Authorization Code URL
67
48
 
68
- The URL for users to click on the "Authorizate" button. An authorization code will sent to the redirect URL defined in your app
49
+ After the client is created, use the client object to generate authorization URL by specifying scopes. It is shown below in code:
50
+
51
+ ```ruby
52
+ scopes = [
53
+ IntuitOAuth::Scopes::ACCOUNTING
54
+ ]
55
+
56
+ authorizationCodeUrl = oauth_client.code.get_auth_uri(scopes)
57
+ # => https://appcenter.intuit.com/connect/oauth2? client_id=clientId&redirect_uri=redirectUrl&response_type=code&scope=com.intuit.quickbooks.accounting&state=rMwcoDITc2N6FJsUGGO9
58
+ ```
59
+ Redirect your users to the authorizationCodeUrl, and an authorization code will be sent to the Redirect URL defined. The authorization code will be used to exchange for an oAuth 2.0 access token later.
69
60
 
70
- url = oauth_client.code.get_auth_uri(scopes)
71
-
72
61
  ### Exchange Authorization Code for OAuth 2.0 Token
73
62
 
74
- Once the user has authorized your app, an authorization code will be sent to your Redirect_URL defined in your client. Exchange the authorization code for an OAuth 2.0 token object.
63
+ Once the user has authorized your app, an authorization code will be sent to your RedirectURL defined in your client. Exchange the authorization code for an OAuth 2.0 token object.
75
64
 
76
65
  result = oauth_client.token.get_bearer_token('The_authorization_code')
77
66
 
78
-
79
67
  ### Refresh Token
80
68
 
81
- Refresh the OAuth 2.0 token using refresh token. Remember to store the OAuth 2.0 refresh token to your own database.
69
+ Your app must keep track of when a stored access token can be used and when the token must be refreshed. Use the refresh method to refresh the token when the token expired. ALWAYS STORE THE LATEST REFRESH TOKEN RETURNED. Below is an exanmple how to use the refresh method to refresh token:
82
70
 
83
71
  newToken = oauth_client.token.refresh_tokens('Your_refresh_token')
84
72
 
73
+ ### Revoke Token
74
+
75
+ If your app is disconnected by the user, you would need to revoke the token. Use revoke_tokens method to revoke the token:
76
+
77
+ trueOrFalse = oauth_client.token.revoke_tokens('the_token_you_want_to_revoke')
78
+
79
+
85
80
  ### Get User Info
86
81
 
87
- Get the user info based on the scopes for OpenID
82
+ If OpenID scope is set when you generate the authorization URL, you can use get_user_info to get the user information:
88
83
 
89
84
  result=oauth_client.openid.get_user_info('accessToken')
85
+
86
+
90
87
 
91
88
  ### Call migration method
92
89
 
93
90
  If you have migrated your OAuth 1.0 app to OAuth 2.0 app, and want to exchange your OAuth 1.0 token to OAuth 2.0 token, use migrate_tokens method
94
91
 
95
- result=oauth_client.Migrate.migrate_tokens(consumer_key, consumer_secret, access_token, access_secret, scopes)
92
+ result=oauth_client.migration.migrate_tokens(consumer_key, consumer_secret, access_token, access_secret, scopes)
93
+
94
+ ### A Complete Usage Example for Creating OAuth 2.0 token
95
+
96
+ The below example tells how to construct the IntuitOAuth Client and use it to generate an OAuth 2 token.
97
+
98
+ ```ruby
99
+ require 'intuit-oauth'
100
+
101
+ oauth_client = IntuitOAuth::Client.new('client_id', 'client_secret', 'redirectUrl', 'environment')
102
+ scopes = [
103
+ IntuitOAuth::Scopes::ACCOUNTING
104
+ ]
105
+
106
+ authorizationCodeUrl = oauth_client.code.get_auth_uri(scopes)
107
+ # => https://appcenter.intuit.com/connect/oauth2?client_id=clientId&redirect_uri=redirectUrl&response_type=code&scope=com.intuit.quickbooks.accounting&state=rMwcoDITc2N6FJsUGGO9
108
+
109
+ oauth2Token = oauth_client.token.get_bearer_token('the authorization code returned from authorizationCodeUrl')
110
+ # => #<IntuitOAuth::ClientResponse:0x00007f9152b5c418 @access_token="the access token", @expires_in=3600, @refresh_token="the refresh token", @x_refresh_token_expires_in=8726400>
111
+
112
+ ```
96
113
 
97
114
  Issues and Contributions
98
115
  ------------------------
99
116
 
100
- Please open an `issue <https://github.com/intuit/oauth-rubyclient/issues>` on GitHub if you have a problem, suggestion, or other comment.
117
+ Please open an [issue](https://github.com/intuit/oauth-rubyclient/issues) on GitHub if you have a problem, suggestion, or other comment.
101
118
 
102
119
  Pull requests are welcome and encouraged! Any contributions should include new or updated unit tests as necessary to maintain thorough test coverage.
103
120
 
104
121
  License
105
122
  -------
106
123
 
107
- intuit-oauth is provided under Apache 2.0 found `<https://github.intuit.com/hlu2/oauth-rubyclient/blob/master/LICENSE>`__
124
+ Intuit-oauth Ruby gem is provided under Apache 2.0 License
@@ -4,9 +4,8 @@ lib = File.expand_path('../lib', __FILE__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.add_dependency 'httparty', '~> 0.16.3'
7
+ spec.add_dependency 'httparty', '>= 0.16.3'
8
8
  spec.add_dependency 'json', '~> 2.1'
9
- spec.add_dependency 'json_web_token', '~> 0.3.5'
10
9
  spec.add_dependency 'rsa-pem-from-mod-exp', '~> 0.1.0'
11
10
 
12
11
  spec.authors = ['Intuit Inc']
@@ -18,7 +17,7 @@ Gem::Specification.new do |spec|
18
17
  spec.required_ruby_version = '>= 1.9.0'
19
18
  spec.required_rubygems_version = '>= 1.3.5'
20
19
  spec.summary = 'A Ruby wrapper for the OAuth 2.0 protocol.'
21
- spec.version = '1.0.0'
20
+ spec.version = '1.0.1'
22
21
 
23
22
  spec.require_paths = %w[lib]
24
23
  spec.bindir = 'exe'
@@ -13,7 +13,6 @@
13
13
  # limitations under the License.
14
14
 
15
15
  require 'rsa_pem'
16
- require 'json_web_token'
17
16
 
18
17
  require_relative '../base'
19
18
 
@@ -47,6 +47,7 @@ module IntuitOAuth
47
47
  oauth1_header = IntuitOAuth::Utils.get_oauth1_header('POST', migration_endpoint, oauth1_tokens)
48
48
  headers = {
49
49
  'Content-Type': 'application/json',
50
+ Accept: 'application/json',
50
51
  Authorization: oauth1_header
51
52
  }
52
53
 
@@ -57,7 +58,7 @@ module IntuitOAuth
57
58
  client_secret: @client.secret
58
59
  }
59
60
 
60
- IntuitOAuth::Transport.request('POST', migration_endpoint, headers, body)
61
+ IntuitOAuth::Transport.request('POST', migration_endpoint, headers, body.to_json)
61
62
  end
62
63
 
63
64
  end
@@ -0,0 +1 @@
1
+ This is the folder for PRS view image
Binary file
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intuit-oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Intuit Inc
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-03 00:00:00.000000000 Z
11
+ date: 2019-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.16.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.16.3
27
27
  - !ruby/object:Gem::Dependency
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.1'
41
- - !ruby/object:Gem::Dependency
42
- name: json_web_token
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 0.3.5
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 0.3.5
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rsa-pem-from-mod-exp
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -208,6 +194,8 @@ files:
208
194
  - lib/intuit-oauth/response.rb
209
195
  - lib/intuit-oauth/transport.rb
210
196
  - lib/intuit-oauth/utils.rb
197
+ - views/PRSWidget.txt
198
+ - views/SDK.png
211
199
  homepage: https://github.com/intuit/oauth-rubyclient
212
200
  licenses:
213
201
  - Apache-2.0