BingAds / BingAds-Python-SDK

Other
115 stars 162 forks source link

Python Error: error_code: invalid_grant, error_description: AADSTS70000: The request was denied because one or more scopes requested are unauthorized or expired. The user must first sign in and grant the client application access to the requested scope #284

Open menporulporiayalan opened 1 month ago

menporulporiayalan commented 1 month ago

Hello,

I am getting this error while I am fetching 'authorization_data'. But it is running good in my staging and local environment but its not working in my production.

I have cross-checked my 'developer_token', 'client_id' and 'client secret' multiple times. It is all good still I am still getting this error.


def find_customerid(shop_id, refresh_token):
       authorization_data = set_authorization(shop_id,None, None, refresh_token)
       customer_service = ServiceClient(service='CustomerManagementService', version=13, authorization_data=authorization_data, environment='production')
def set_authorization(shop_id,account_id, customer_id, refresh_token):
     authorization_data = AuthorizationData(
        account_id= account_id,
        customer_id= customer_id,
        developer_token= developer_token',
        authentication= OAuthWebAuthCodeGrant(
            client_id= my_client_id,
            client_secret=my_client_secret,
            redirection_uri=my_redirection_uri,
            )
        )
        authorization_data.authentication.request_oauth_tokens_by_refresh_token(refresh_token)
        return authorization_data