@@ -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
0 commit comments