Skip to content

Commit c42fcdc

Browse files
committed
Cleaned up readme.
1 parent e00cd0a commit c42fcdc

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ Changelog
33

44
* 0.7.5 (October 18th, 2018)
55
* Fixed bug with reporting authentication failure when attempting to download PDF (previously the error details were "lost")
6-
* Added get_new_access_tokens to Oauth2SessionManager
6+
* Added refresh_access_tokens to Oauth2SessionManager
7+
* Added missing LinkedTxn to Bill object.
78
*
89

910
* 0.7.4 (March 26th, 2018)

README.rst

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Existing applications can continue to use OAuth 1.0 (See `OAuth 1.0 vs. OAuth 2.
1919

2020

2121
Connecting your application with quickbooks-cli
22-
-------------------
22+
------------------------------------------------
2323

2424
From the command line, call quickbooks-cli tool passing in either your consumer_key and consumer_secret (OAuth 1.0)
2525
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:
3030
3131
3232
Manually connecting with OAuth version 1.0
33-
--------
33+
--------------------------------------------
3434

3535
1. Create the Authorization URL for your application:
3636

@@ -75,7 +75,7 @@ Store ``realm_id``, ``access_token``, and ``access_token_secret`` for later use.
7575

7676

7777
Manually connecting with OAuth version 2.0
78-
--------
78+
--------------------------------------------
7979

8080
1. Create the Authorization URL for your application:
8181

@@ -111,31 +111,24 @@ Manually connecting with OAuth version 2.0
111111
refresh_token = session_manager.refresh_token
112112
113113
Store ``access_token`` and ``refresh_token`` for later use.
114-
114+
See `Unable to get Access tokens`_ for issues getting access tokens.
115115

116116
Refreshing Access Token
117117
-----------------------
118118

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:
125120

126121
.. 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)
134122
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()
136130
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``.
139132

140133
Accessing the API
141134
-----------------

0 commit comments

Comments
 (0)