Genesys Cloud Python Client Credentials Example

Hi,

I am trying to connect Genesys API using Python. I used the sample code from Genesys along with user id credentials but throwing me forbidden 403 error, I am able to request the token but not getting it. Can anyone please help me.

Hi Gomathy,

To clarify, are you using the client credentials grant? If yes, it sounds like you could be trying to access an endpoint that requires user context. If this is the case, switching to Code Authorization or Implicit Grant would fix the problem.

Hope that helps.
Charlie

Hi, thanks for the reply. yes I am using client credentials grant, can I please know how to get code authorization or implicit grant.

Of course. There are a few different resources on our dev centre...

Here is a high-level overview of the Code Auth process: https://developer.genesys.cloud/authorization/platform-auth/use-authorization-code

And here is a code example: https://developer.genesys.cloud/authorization/platform-auth/guides/oauth-auth-code-guide. (Notice there are links to the original source code on GitHub)

Incorporating the example above into your own source code might be a bit awkward, so it's worth noting that you just need to get the access token. After that, you can set it directly:

PureCloudPlatformClientV2.configuration.access_token = 'your_access_token'

And if you haven't seen it already, here is another page that walks through getting setup with the Python SDK. Maybe there's something in here that can solve your problem. https://developer.genesys.cloud/devapps/sdk/docexplorer/purecloudpython/#authorization-code-grant.

Let me know if you have any more questions.

Regards,
Charlie

Thanks for providing me the resources, let me work on that and will contact if I have any doubts.