@@ -19,7 +19,7 @@ Existing applications can continue to use OAuth 1.0 (See `OAuth 1.0 vs. OAuth 2.
19
19
20
20
21
21
Connecting your application with quickbooks-cli
22
- -------------------
22
+ ------------------------------------------------
23
23
24
24
From the command line, call quickbooks-cli tool passing in either your consumer_key and consumer_secret (OAuth 1.0)
25
25
or your client_id and client_secret (OAuth 2.0), plus the OAuth version number:
@@ -30,7 +30,7 @@ or your client_id and client_secret (OAuth 2.0), plus the OAuth version number:
30
30
31
31
32
32
Manually connecting with OAuth version 1.0
33
- --------
33
+ --------------------------------------------
34
34
35
35
1. Create the Authorization URL for your application:
36
36
@@ -75,7 +75,7 @@ Store ``realm_id``, ``access_token``, and ``access_token_secret`` for later use.
75
75
76
76
77
77
Manually connecting with OAuth version 2.0
78
- --------
78
+ --------------------------------------------
79
79
80
80
1. Create the Authorization URL for your application:
81
81
@@ -111,31 +111,24 @@ Manually connecting with OAuth version 2.0
111
111
refresh_token = session_manager.refresh_token
112
112
113
113
Store ``access_token `` and ``refresh_token `` for later use.
114
-
114
+ See ` Unable to get Access tokens `_ for issues getting access tokens.
115
115
116
116
Refreshing Access Token
117
117
-----------------------
118
118
119
- at some point your access token will expire, that is why you were given
120
- a ``refresh_token ``, once your requests get an ``AuthorizationException ``
121
- you need to use your client to refresh the access token, do this by calling
122
- its ``refresh_access_token `` method, it takes no arguments, and sets the new
123
- refresh token and access tokens on itself as instance attributes, so youll need
124
- to replace the tokens you were using, ie:
119
+ When your access token expires, you can refresh it with the following code:
125
120
126
121
.. code-block :: python
127
- try :
128
- Bill.all(qb = client)
129
- except exceptions.AuthorizationException:
130
- client.refresh_access_token()
131
- MODEL_TO_STORE_TOKENS .access_token = client.access_token
132
- MODEL_TO_STORE_TOKENS .refresh_token = client.refresh_token
133
- Bill.all(qb = client)
134
122
135
- now you can make authorized requests again.
123
+ session_manager = Oauth2SessionManager(
124
+ client_id = QUICKBOOKS_CLIENT_ID ,
125
+ client_secret = QUICKBOOKS_CLIENT_SECRET ,
126
+ base_url = callback_url,
127
+ )
128
+
129
+ session_manager.refresh_access_token()
136
130
137
- Store ``access_token `` for later use.
138
- See `Unable to get Access tokens `_ for issues getting access tokens.
131
+ Be sure to update your stored ``access_token `` and ``refresh_token ``.
139
132
140
133
Accessing the API
141
134
-----------------
0 commit comments