labd / commercetools-python-sdk

Commercetools Python SDK
https://commercetools-python-sdk.readthedocs.io/en/latest/
MIT License
17 stars 16 forks source link

Issue with scope value #140

Open anjalipowells opened 1 year ago

anjalipowells commented 1 year ago

Problem When I try to create a client using Python SDK, I get a warning in scope value. If I follow the warning and fix it, I get error in scope value Warning: Scope has changed from “manage_products:” to “manage_products:{project_key} view_products:{project_key}. Error: Permissions exceeded. Only the following permissions can be requested: manage_products

Using the below code to connect:

client = Client(
    client_id="my-client-id",
    client_secret="my-client-secret",
    # scope=["manage_products:{project-key}"],
    scope=["manage_products:{project-key}", "view_products:{project-key}"],
    url="https://api.{region}.gcp.commercetools.com",
    token_url="https://auth.{region}.gcp.commercetools.com",
)

client = Client()

product = (
    client
    .with_project_key("project_key")
    .products()
    .with_id({guid_Id})
    .get())
dimentii commented 11 months ago

Faced same issue Fixed by adding OAUTHLIB_RELAX_TOKEN_SCOPE environment variable.