Legacy Dev Forum Posts

 View Only

Sign Up

Oauth authorizaion in Python - Bad Credentials

  • 1.  Oauth authorizaion in Python - Bad Credentials

    Posted 06-05-2025 18:07

    JF2016 | 2016-08-05 09:27:45 UTC | #1

    I am starting with the Python SDK an have problems with the credentials.

    I have used the tutorial für authorization with client credential. I get a token an can get the list of roles by using requests:

    response = requests.get('https://api.mypurecloud.ie/api/v2/users', headers=requestHeaders)

    But when i try to use the SDK like this: "# Configure OAuth2 access token for authorization: PureCloud Auth" PureCloudPlatformApiSdk.configuration.accesstoken = responseJson['accesstoken'] "# create an instance of the API class" api_instance = PureCloudPlatformApiSdk.UsersApi()

    apiresponse = apiinstance.getusers(pagesize=pagesize, pagenumber=pagenumber, id=id, sortorder=sort_order, expand=expand)

    I always get an error: {"status":401,"code":"bad.credentials","message":"Invalid login credentials."}


    KevinGlinski | 2016-08-05 10:39:48 UTC | #2

    are you setting the environment to .ie?

    PureCloudPlatformApiSdk.configuration.host = 'https://api.mypurecloud.ie'


    JF2016 | 2016-08-05 11:19:27 UTC | #3

    No i haven't. Now it is working after setting the correct environment. Now i have seen, it is mentioned in the Chapter: Using the library.

    Thank You.


    system | 2017-08-28 19:26:04 UTC | #4


    This post was migrated from the old Developer Forum.

    ref: 249