Skip to content

Commit 51e63a1

Browse files
committed
update client credentials token method
1 parent 8fb3aa1 commit 51e63a1

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

docs/v1/accounting/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5936,7 +5936,7 @@
59365936
<nav id="scrollingNav">
59375937
<ul class="sidenav nav nav-list">
59385938
<li class="nav-header" data-group="Accounting"><strong>SDK: </strong><span id='sdk-name'></span></li>
5939-
<li class="nav-header" data-group="Accounting"><strong>VSN: </strong>1.9.0b2</li>
5939+
<li class="nav-header" data-group="Accounting"><strong>VSN: </strong>1.9.0b3</li>
59405940
<li class="nav-header" data-group="Accounting"><a href="#api-Accounting">Methods</a></li>
59415941
<li data-group="Accounting" data-name="createAccount" class="">
59425942
<a href="#api-Accounting-createAccount">createAccount</a>

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ def read_file(filename):
4848
keywords="xero python sdk API oAuth",
4949
name="xero_python",
5050
packages=find_packages(include=["xero_python", "xero_python.*"]),
51-
version="1.9.0b2",
51+
version="1.9.0b3",
5252
)

xero_python/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
__author__ = """Xero Developer API"""
44
__email__ = "[email protected]"
5-
__version__ = "1.9.0b2"
5+
__version__ = "1.9.0b3"

xero_python/api_client/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,13 +758,13 @@ def revoke_oauth2_token(self):
758758
if oauth2_token.revoke_access_token(self):
759759
return self.get_oauth2_token()
760760

761-
def get_client_credentials_token(self):
761+
def get_client_credentials_token(self, app_store_billing=False):
762762
"""
763763
Obtain oauth2 token using client credentials grant type
764764
:return: oauth2 token
765765
"""
766766
oauth2_token = self.configuration.oauth2_token
767-
if oauth2_token.get_client_credentials_access_token(self):
767+
if oauth2_token.get_client_credentials_access_token(self, app_store_billing):
768768
return self.get_oauth2_token()
769769

770770
def oauth2_token_getter(self, token_getter):

xero_python/api_client/oauth2.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def revoke_token(self, refresh_token):
8181
)
8282
return status
8383

84-
def get_client_credentials_token(self):
84+
def get_client_credentials_token(self, app_store_billing):
8585
"""
8686
Call Xero Identity API to obtain an access token via OAuth2 Client Credentails grant type
8787
:return: dictionary with new auth2 token
@@ -91,6 +91,8 @@ def get_client_credentials_token(self):
9191
"client_secret": self.client_secret,
9292
"grant_type": "client_credentials",
9393
}
94+
if app_store_billing:
95+
post_data["scope"] = "marketplace.billing"
9496
response, status, headers = self.api_client.call_api(
9597
self.client_credentials_token_url,
9698
"POST",
@@ -231,14 +233,14 @@ def refresh_access_token(self, api_client):
231233
api_client.set_oauth2_token(new_token)
232234
return True
233235

234-
def get_client_credentials_access_token(self, api_client):
236+
def get_client_credentials_access_token(self, api_client, app_store_billing):
235237
"""
236238
Perform OAuth2 Client Credentials grant token request.
237239
:param api_client: ApiClient instance used to perform refresh token API call.
238240
:return: bool - True if success
239241
"""
240242
token_api = TokenApi(api_client, self.client_id, self.client_secret)
241-
new_token = token_api.get_client_credentials_token()
243+
new_token = token_api.get_client_credentials_token(app_store_billing)
242244
self.update_token(**new_token)
243245
api_client.set_oauth2_token(new_token)
244246
return True

xero_python/docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ These endpoints are related to managing authentication tokens and identity for X
44
The `xero_python` package is automatically generated by the [XeroAPI SDK 2.0 Codegen](https://github.com/xero-github/xeroapi-sdk-codegen) project:
55

66
- API version: 2.16.1
7-
- Package version: 1.9.0b2
7+
- Package version: 1.9.0b3
88
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
99
For more information, please visit [https://developer.xero.com](https://developer.xero.com)
1010

0 commit comments

Comments
 (0)